Windows provides a builtin command to shutdown, restart as well as logoff a user from the command promptne. This and many other options are provided by the “shutdown” command. In order to find out more options of any command, type :
shutdown /? – command name followed by a forward slash and a question mark.
in Command Prompt ( WIN + R » cmd – here are some more Windows Keyboard shortcuts. You can run any command from Command Prompt or typing the command with full option into the RUN Dialog ( WIN + R ) The main use of all these commands come in batch files and task scheduling. All of these commands are pretty easy to use, please read the article completely before complaining
Basic form of “shutdown”
The most basic form of the command is :
Both perform the same thing – execute shutdown command with option OPTION. OPTION can take many values, only the ones of interest to us are mentioned here.
-l – Logs off the current user
-s – Shutdown the computer
-r – Restart the computer
-a – Aborts a current shutdown command execution
-t XX – if this is added with any of the above ones, you can specify after what time ( XX seconds ) the system should execute the OPTION.
A Simple example and a Screenshot
Here the OPTIONs specify that shutdown command should shutdown the command after 120 seconds.
shutdown -s -t 120
The screen result will be something like this :
Canceling a shutdown
If you have given the time parameter -t XX you will have sometime before the command kicks you out. In that time, if you want to cancel the event just type :
shutdown -a -Abort a shutdown
Add a message
You can add a custom message with shutdown so that, instead of the time frame warning, the user will be presented with your message.
shutdown -s -t 120 -c “You are so screwed”
will present the user with the message – “You are so screwed” as below :