Skip to main content

Shutdown Command Via Command Prompt


Shutdown Command Via Command Prompt


The 'Shutdown' Command Becomes More Flexible and Automated when used from the Command Prompt.

To Run the 'Shutdown' command from the command prompt, go to 'Start > Run', type 'cmd', and press 'Enter'.
In the black box (the command prompt) type 'Shutdown' and the Switches you want to use with the 'Shutdown' command.
You have to use at least one switch for the shutdown command to work.

The Switches :-
The 'Shutdown' command has a few options called Switches. You can always see them by typing 'shutdown -?' in the command prompt if you forget any of them.

-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)

Note :- I’ve noticed using a switch with a '-' sign doesn’t work sometimes.
If you are having trouble try using a '/' in place of '-' in your switches.

Examples :-
shutdown –m \\computername –r –f
This command will restart the computer named computername and force any programs that might still be running to stop.

shutdown –m \\computername –r –f –c “I’m restarting your computer. Please save your work now.” –t 120
This command will restart the computer named computername, force any programs that might still be running to stop, give to user on that computer a message, and countdown 120 seconds before it restarts.

shutdown –m \\computername –a
This command will abort a previous shutdown command that is in progress.

Using A Batch File :-
You can create a file that performs the shutdown command on many computers at one time.

In this example I’m going to create a batch file that will use the shutdown command to shut down 3 computers on my home network before I go to bed.

Open 'Notepad' and type the shutdown command to shut down a computer for each computer on the network.
Make sure each shutdown command is on its own line.
An example of what should be typed in notepad is given below-

shutdown –m \\computer1 –s
shutdown –m \\computer2 –s
shutdown –m \\computer3 -s

Now I’ll save it as a batch file by going to file, save as, change save as type to all files, give the file a name ending with '.bat'. I named mine 'shutdown.bat'.
Pick the location to save the batch file in and save it.

When you run the batch file it’ll shutdown computer 1, 2, and 3 for you.

You can use any combination of shutdown commands in a batch file.

Popular posts from this blog

Publication Tools

Blogs: WordPress Typepad Blogger B2evolution Scribefire Wikis: Wikipedia Wikia Wetpaint Pbwiki Wikispaces Twiki Citizen Journalism Portals: Digg Newsvine Livejournal Sharing Tools: Videos Sharing Tools: YouTube Metacafe Revver Viddler Blip.tv Picture Sharing Tools: FlickR Zooomr Smugmug Links Sharing Tools: del.icio.us Digg Yahoo! Buzz Propeller Technorati StumbleUpon Reddit Ma.gnolia Mixx.com Music Sharing Tools: Last.fm iLike Pandora Odeo Slideshows Sharing Tools: Slideshare Authorstream Myplick Products Feedbacks Sharing Tools: Crowdstorm ...

Effective Eclipse: Shortcut keys

You should try to keep your hands on keyboard. The less you touch the mouse, the more code you can write. I am trying to keep the mouse laying still and control the IDE completely using keyboard. What do you think is faster: pressing ALT + C or right clicking the project, selecting Team -> Commit ? It is said, that if a function does not have a key binding, it is useless. Below you will find a set of essential keyboard shortcuts that I love. These shortcuts are set up by default, they should all work. CTRL + D Delete row. Try it! You no more need to grab the mouse and select the line, no more Home, Shift + End, Delete. Quick and clean. ALT + Up/Down Arrow Move the row (or the entire selection) up or down. Very useful when rearranging code. You can even select more rows and move them all. Notice, that it will be always correctly indented. ALT + Left/Right Arrow Move to the last location you edited. Imagine you just created a class Foo, and now you are working ...

Calculations On Command Prompt

-: Calculations On Command Prompt :- The command processor CMD.EXE comes with a mini-calculator that can perform simple arithmetic on 32-bit signed integers: C:\>set /a 2+2 4 C:\>set /a 2*(9/2) 8 C:\>set /a (2*9)/2 9 C:\>set /a "31>>2" 7 Note that we had to quote the shift operator since it would otherwise be misinterpreted as a "redirect stdout and append" operator. For more information, type set /? at the command prompt.