Shutdown Your Computer or a Remote PC via Command Prompt

Most of us shutdown our computers using the power button given in the Start menu. Some of us use the physical power button on our machines. Very few people actually use other means of shutting down a computer and even less is the number of people who use the Command Prompt to shutdown a computer.

A reason for this is that most of us don't know that the Command Prompt can be used to not only shutdown, restart or log off our computer instantly but also to shutdown a remote computer provided you have administrative access. It can also be used to hibernate a computer and give a comment containing the reason for shutdown. This post will show you how to do all this.

Shutdown computer with command prompt
Required
A computer running Windows (XP, Vista, 7, 8, 8.1 or 10) with the Command Prompt working perfectly, i.e. not disabled by a virus.

Initial Steps
1) Press Windows Key + R.
2) Type CMD and press Ctrl+Shift+Enter.

This will start the Command Prompt as an Administrator (Elevated Command Prompt in newer editions of Windows.) Follow the instructions below depending on what you want to do:

Shutdown Local Machine (Your Computer)
Type "shutdown -s" without the quotes in the Command Prompt and press Enter. Shutdown is the command being executed and the switch -s tells the computer to shutdown.

Restart Local Computer
Type "shutdown -r" in the Command Prompt and press Enter. In this case, the command switch -r is telling the computer to restart after shutdown.

Log Off the Current User
Type "shutdown -l" in the Command Prompt and press Enter. The -l command switch tells the computer to log off.

Shutdown a Remote Computer
Type "shutdown -s -m \\name of the computer" in the Command Prompt and press Enter. Replace \\name of the computer with the actual name of the remote computer you are trying to shutdown. As mentioned earlier, you must have administrative access to the computer you are trying to shutdown. To know if you have administrative access, press Windows key + R and then type the name of the computer and press Enter.

Note: If you don't remember the name of the remote computer, you can look for it by opening a list of all the computers you are connected to by executing "net view" in the Command Prompt.

If you can connect to the computer, you will be asked to login with your username and password. Upon entering them, a window will display the list of all the directories available to you. This should help you know whether you can or cannot shutdown the remote computer.

Hibernate Local Computer
Type in "Rundll32.exe Powrprof.dll,SetSuspendState" without the quotes and press Enter. Your computer should hibernate. If it does not, then you must enable hibernation to do this.

Shutdown local computer or a remote computer after a specific time
Type "shutdown -s -t 60" to shutdown your computer after 60 seconds. Upon executing this, a warning message displaying the time to shutdown will be shown. This command uses the -t command switch followed by a variable (which is 60 in this case) which represents the number of seconds after which the computer will shutdown.

Display a Message containing the reason for shutdown
Type shutdown -s -t 500 -c "I am tired. I don't want to work anymore." (with the quotes) in the Command Prompt and press Enter. The -c switch is used in the code to give the reason for shutting down and what is followed in quotes will be displayed in the dialog box as the reason. This can be used to display all sorts of funny messages. One example :-

Skynet has become self aware. John Connor did not stop me. You can not use your PC anymore.

Stop a System Shutdown
Type "shutdown -a" and press Enter. This will stop the system from shutting down if the time to shut down has not been reached.

Related : Command Prompt Tricks

Reader Comments

Meena said...

wow i didnt know abt this command prompt thing

i use start button to shut down or hibernate or put on stand by

thanks for this

Shop said...

I never thought there would be a much easier way to "shut down" or "restart" a computer aside from the start menu button. Thanks for sharing.

Anonymous said...

Hey I never knew we could do all such things with the command prompt. Thanks for sharing.

Anonymous said...

I would love to learn that language used in the notepad tricks. Thanks for sharing these cool prompt advantages.

Anonymous said...

How can i make a .bat file with a code to shut down a pc by opening that file. Idea for a prank

Anonymous said...

Well.. Thats easy .. If my memory serves me right the code is "Start Cmd [enter] Shutdown -s -t (number of seconds)" input that code in a wordpad notepad etc. File call it whatever.bat or something when the person opens the file pc should shutdown and like described above you can input an error message.

Anonymous said...

U can also use short cut

C:\Windows\System32\cmd.exe /c- (command)

Or

C:\Windows\System32\cmd.exe /k- (command)

k- the cmd will still open

c- the cmd will close after putting the command

Author About

Akhilesh Sharma maintains and writes Tweak And Trick. He is a technology enthusiast and a science student.
You can contact him at tweakandtrick@gmail.com.

read more >>
Featured Posts