How To Shutdown Windows From Command Line with Shutdown Command Examples and Tutorial
Windows operating systems provide the command
shutdown which has a lot of functions like a reboot, shutdown, logoff etc. In this tutorial, we will look most useful of them. Windows XP is a very old operating system where it may lack some of the options and features described here. We will use to
cmd.exe run from CLI.
shutdown command syntax is like below.
shutdown OPTIONS COMPUTER COMMENT
OPTIONSis used for different type of options like restart, logoff etc.
COMPUTERis used when we need to run
shutdowncommand on the remote computer
COMMENTis used with comment feature to provide message
Now the main purpose of the command
shutdown is shutting down the system or computer. Just providing the command
shutdown is not enough. We should provide the option
/s in order to shut down the system.
> shutdown /s
We can also restart the system with the command
shutdown. We will provide the option
/r in order to restart the system or computer. This will shut down and restart the computer.
> shutdown /r
Logout From Current GUI Session
If we have logged in with the GUI we may need to log out from the current session. We will use the option
/l in order to log out from the current user session.
> shutdown /l
Abort System Shutdown
By default when we issue shutdown command the computer will not shut down immediately. There are 60 seconds wait time before shutdown. We can cancel the shutdown operation with which
/a means abort.
> shutdown /a
Hibernate feature will make computer sleep and wake up in seconds without starting from scratch. We can hibernate the computer with the option
/h like below.
> shutdown /a
Send Message To System Users
A typical server will be used more than one person. There may be other persons who are using server currently. We need to provide information about a shutdown, restart. We can use the option
/c with the message. The message will be put into double quotes.
> shutdown /s /c "The system will be shut down in 60 seconds."
Specify Time or Interval For Shutdown and Restart
Default shutdown interval or time may be enough for us or other computer and system users. We can specify the interval we need with the option
/t and time value. In this example, we will specify a waiting time for 120 seconds for the shutdown. Merging this option with send message will be very useful.
> shutdown /s /t 120 /c "Shutdown in 120 seconds"