Shutdown Windows Using Command Prompt

Windows provide two types of interface to shutdown your system. One is the Graphical User Interface and the other is the Character User Interface (Dos).

Shutdown windows using GUI

In order to shut down windows (Any Version), the GUI window steps are –

  1. Go to Start
  2. Select “Turn Off Computer” Icon
  3. Press “Shutdown” Icon

Shutdown windows with the help of Command Prompt

The Dos command provides simple “shutdown -?”, command to shut down your windows system. Though it looks simple there are many associated switches and sub command which can help you accomplish your task more effectively. Let us see in detail what actually is shutdown command and its associated switches.

Shutdown Command Switch

Name of Switch/es Brief Information about the execution
-i This helps us to show GUI. This is always the first switch during execution
-l This command makes the user session to “log off”. This does not work for remote executions.
-s This simply Shuts down the local system
-r As the name suggests, it simply makes your system “restart”
-a Aborts all previous shutdown/restart commands. This command can also be used to terminate any shutdown progress.
-f This switch terminates all open programs and closes any file and forces shutdown. This will lead to loss of any unsaved data or transaction in progress during the command execution.
-m \\computername This is used with remote machines only. This option is also used in conjunction with both “restart” and “–a” switch.
-t xx Here the “xx” stands for the amount of time in seconds before the machine from “restart”.
-c “comment” This displays comment before the shutdown being processed. [Max 27 chars]

How to use Shutdown Command and Switches

Though all the switches need not be used all together but they are bound to follow this sequence –

shutdown [-i | -l | -s | -r | -a] [-f] [-m \\YourHostName] [-t xx] [-c "Your personal comment / or reason for shutting down system"] [-d up:xx:yy]

How to Open Command Prompt

Method 1: Press Windows Key + R and type “cmd” (Without quotes) and Press Enter.

Method 2: Select “Start”, find “RUN” panel. Type “cmd” (without quotes). Press Enter.

Now you should have the Command Prompt window in your screen with the cursor blinking for you Input. Let the show begin.

How to Shut Down Local Machine

Simplest way to shut down Local machine is to use the “–s” switch with the shutdown command. Type the following code in the command prompt and just press Enter:

shutdown –s

This command will ask your Operating system to shutdown and it will immediately start the process giving you a 30 second (default) timeout window.

How to Shutdown with Timer

shutdown –s –t 90

Here in we have added the “-t” switch so as to provide a variable which stores the value “90” and provide a 90 sec timeout window before shutting down your system. The Integer is always in seconds. Here it is 90 seconds.

Show comment before Shutdown

There might be some cases where you need the users logged in be shown a specific comment or set of text which might be the reason for shutting down that machine. Here you need t use the “-c” switch to provide the information.

shutdown –s –t 90 –c “Save all your works in 90 seconds as the machine will shutdown after that”

Here the comment can be a maximum of 27 characters. You cannot change it.

How to Shutdown a Remote Computer

shutdown –s –m \\hostname –t -90

This is the most impressive switch of all the available options for the shutdown command. The “-m” switch triggers a remote shutdown sequence. In our example here we have the remote system whose name is “hostname”. The shutdown sequence will give a timeout period of 90 seconds and will shut down the remote machine.

Sometimes it has been seen that the remote system does not allow remote command execution. In such cases you need to log in the remote system with the associated username and pass. After a confirmation is done you can then shutdown the remote machine with the aforesaid command.

In order to log in to the remote machine use the following command in the run panel.

// hostname

Here, the hostname is the name of the remote computer you want to log in.

How to cancel shutdown

It is always better to know the prevention if anything goes wrong. If you have a shutdown timer in sequence any you realize that there are some unsaved data, you need to execute the following shutdown command to terminate it.

shutdown –a

The above command will terminate any on hold shutdown queue and clear out all shutdown instances. Do remember to punch in the code before the timer hits zero, just in case!!!!

How to restart using Command Prompt

Restart is a process which includes shutdown as an integral part. So if you want to restart your system using command prompt, you need to shut it down first and then order it to restart. The following code will help you to restart using Dos Command.

shutdown –r

This article is written for advanced users. If you are not aware of basic tricks and not an average tech guy, please avoid it to stay out of trouble. Just in case anything goes wrong follow the abort command (Cancel Shutdown Command).

Latest Comments
  1. Shivam

    Hey
    when i gave the command a msgbox sort appeared but it was showing my p.c ‘s name.
    friends detected me by using the name and detecting my computer
    any ideas on how to remove\hide that thing

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>