How to Shutdown or Restart Windows From the Command Line

(0 votes, average 0 out of 5)

To shutdown or restart windows from the command line or using a shortcut, you must use the Shutdown.exe program. 

To use this program, open up a command prompt window. This can be done by navigating to Start -> Run and typing in 'cmd'.

Once the command prompt is open, use the following command:

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


Arguments: 

 No args Display this message (same as -?)

-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
-m computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c “comment” Shutdown 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)

 

Here are a few examples:

shutdown -r Restarts the computer.
shutdown -s Shutdown the computer.
shutdown -s -t 45       Shutdown the computer in 45 seconds.

 


Partner Links:
Last Updated on Sunday, 11 July 2010 18:40  
Related Articles

» How to Change File Association in Windows

This guide is valid for Windows XP, Windows Vista, and Windows 7.  Windows holds a default program that should be used to open each type of file on your computer.  Many times, installing a new program (such as iTunes)  that handles certain file types will automatically change what file types it will open by default and often this is configurable after installation as well.  However, you can manually change the program Windows uses with the following steps.Click on Start...

» How to use Adobe Photoshop's "Alt" Key in Ubuntu 11.10 and Later

When using Adobe Photoshop under WINE on Linux, it is necessary to be able to use the Alt key for a variety of Photoshop actions, such as selecting a source for the Clone Tool. By default, GNOME binds to the Alt key, which prevents Photoshop from being able to use it. In order to change GNOME's Alt keybinding, do the following:Open the Ubuntu Software Center and install gconf-editor (or from the command line sudo apt-get install gconf-editor)Open the Dash or a terminal and launch...

» For Loops in PHP

To create a for loop in php, follow these simple steps:Set a counter variable to some initial value.Check to see if the conditional statement is true.Execute the code within the loop.Increment a counter at the end of each iteration through the loop.The following is pseudo php code for a for loop:123for(init counter; conditional statement; increment counter){ inner code;}As you can see, all of the above steps are taken care of within the for loop, making the syntax short and easy to...