Shutdown Computer With Command Prompt

Sometime back I posted a trick on how to open command prompt on right click. Again I am going to show a trick on command prompt i.e how to shutdown a computer using command prompt on windows.

How to shutdown, restart or log off using command prompt

I am going to explain how to shutdown, restart, log off, schedule a shutdown on a computer using command prompt. Its quiet easy, just follow the following instructions.

List of Shutdown Command Switches

Take a note of this shutdown command switches. You will use them in your commands.

No Switches

Display information about the shutdown command, same as typing “-?”

-i

Display a GUI. It must be the first switch

-l

Log off the user (This cannot be used on a remote machine: “-m” switch)

-s

Shutdown the computer

-r

Restart the computer

-a

Cancels a system shutdown already in progress

-f

Forces running applications to close without warning

-m \\computername

Instruct a remote computer to shutdown (can be used with the restart & abort switches)

-t xx

Set a given time for shutdown, in seconds

-c “comment”

Shutdown comment (maximum of 127 characters)

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

How To Use Shutdown Switches

You don’t have to use them all, but the switches you do use must be in the following order:

How To Open Command Prompt

Open the command prompt: Windows Key + R then type the "cmd" and hit Ok. This will open the command prompt.

Note: You can directly type the shutdown command directly into the Run dialog.

Shutdown Local Machine

Type the code below and press enter:

shutdown -s

“shutdown” tells the computer what command we want to execute and the “-s” switch tells it what to do, which is to shutdown!

Similarly to perform various operations like restart, log off etc., use the respective switches. For e.g. to log off use -l instead of -s

shutdown -l

Specify Time

shutdown -s -t 60

Now we have added the “-t” switch and a variable, which in this case is “60″. This number is the number of seconds before the computer is shutdown. A dialog will open and display a count down timer!

Use Comment

shutdown -s -t 120 -c "PC going to shut down!"

The “-c” switch will allow you to give the user some information for the reason of the shutdown.

Shutdown A Remote Computer

shutdown -s -m \\desktop -t 45

I really like this one! The “-m” switch will allow you to shutdown a remote machine, in this case, a computer named “desktop”. For this to work, you must have administrative access to the computer! To see of you do, hit Windows Key + R then type the computer’s name, i.e.:

\\desktop

If you can connect to it, you will be asked to log into the machine with a user name and password. Once confirmed, a window will open displaying the directories available to you. Now you know you can shut it down remotely.

Cancel Shutdown

If you want to cancel a shutdown in progress. Press Windows Key + R then type command below:

1 comments:

this program called Fast Shutdown has a command line too, so you can just call it like any other function. It also has the options to Fast Shutdown, normal shutdown, restart and so forth! you can download it here http://www.xetoware.com/fast-shutdown.html