How to shutdown, restart, logoff using command prompt?
Basic form of “shutdown”
The most basic form of the command is :
shutdown -OPTION
OR
shutdown /OPTION
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 :
Comments
Post a Comment