There are times when you are downloading something during the night and want to shutdown the computer after the duration of download, this can be done automatically in software's like utorrent but if you are using web browser based downloads, then to shutdown the pc after a certain specified time limit you can use the shutdown command.

Shutdown Command:-The command has ability to shutdown remote computers and the command also provides a large number of options. Most useful option is the time limit that can be set, most system administrators use this command in linux, unix or windows xp. Also a message can be displayed at the time of shutdown explaining the reason for shutdown.

The command:-

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

Options:-

No args Display the help message (same as -? or /?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown(useful for aborting a planned shutdown)
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown reason/comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)

Example usage:-

If you want to shutdown computer after 3 hours then you have to convert the time into seconds and use the following command.

shutdown -s -t 10800 -c "planned shutdown"

The output will be like the following :-
















You can always abort a initiated shutdown by opening the command prompt and typing shutdown -a.

Note: There is another utility TSSHUTDN available on windows xp that does the same thing but this utility is not available in Windows Vista.