Windows shutdown Command Tutorial

All modern Windows operating systems provide the shutdown command which is used to shut down or turn off the windows system from the command line easily. The shutdown command is used with different options for different shutdown behaviors.

shutdown Command Syntax

shutdown command has the following simple syntax where only options can be provided to the shutdown command. In order to run the shutdown command the user has Shut down the system user privileges which are generally provided to the regular users.

shutdown OPTION
  • OPTION will change the shutdown command behaivour.

shutdown Options and Parameters

shutdown command provides a lot of options in order to reboot, completly shutdown or logoff current user session.

OPTIONDESCRIPTION
/iDisplay Remote Shutdown Box
/lLog off current user session immediately
/sShutdown computer
/rRestart computer
/aAbort shutdown
/hHibernate computer
/eTake note for the shutdown reason
/fForce shutdown without warning users
/mSpecify remote computer
/tSet time-out period or delay
/dList the reason for restart or shutdown
/cComment shutdown reason (limited with 511 characters)
/?Display help information

Display Help Information

Detailed help information about the shutdown command can be listed in the command line with the /? parameter.

C:\>shutdown /?
Usage: shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f]
    [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

    No args    Display help. This is the same as typing /?.
    /?         Display help. This is the same as not typing any options.
    /i         Display the graphical user interface (GUI).
               This must be the first option.
    /l         Log off. This cannot be used with /m or /d options.
    /s         Shutdown the computer.
    /sg        Shutdown the computer. On the next boot, if Automatic Restart Sign-On
               is enabled, automatically sign in and lock last interactive user.
               After sign in, restart any registered applications.
    /r         Full shutdown and restart the computer.
    /g         Full shutdown and restart the computer. After the system is rebooted,
               if Automatic Restart Sign-On is enabled, automatically sign in and
               lock last interactive user.
               After sign in, restart any registered applications.
    /a         Abort a system shutdown.
               This can only be used during the time-out period.
               Combine with /fw to clear any pending boots to firmware.
    /p         Turn off the local computer with no time-out or warning.
               Can be used with /d and /f options.
    /h         Hibernate the local computer.
               Can be used with the /f option.
    /hybrid    Performs a shutdown of the computer and prepares it for fast startup.
               Must be used with /s option.
    /fw        Combine with a shutdown option to cause the next boot to go to the
               firmware user interface.
    /e         Document the reason for an unexpected shutdown of a computer.
    /o         Go to the advanced boot options menu and restart the computer.
               Must be used with /r option.
    /m \\computer Specify the target computer.
    /t xxx     Set the time-out period before shutdown to xxx seconds.
               The valid range is 0-315360000 (10 years), with a default of 30.
               If the timeout period is greater than 0, the /f parameter is
               implied.
    /c "comment" Comment on the reason for the restart or shutdown.
               Maximum of 512 characters allowed.
    /f         Force running applications to close without forewarning users.
               The /f parameter is implied when a value greater than 0 is
               specified for the /t parameter.
    /d [p|u:]xx:yy  Provide the reason for the restart or shutdown.
               p indicates that the restart or shutdown is planned.
               u indicates that the reason is user defined.
               If neither p nor u is specified the restart or shutdown is
               unplanned.
               xx is the major reason number (positive integer less than 256).
               yy is the minor reason number (positive integer less than 65536).

Reasons on this computer:
(E = Expected U = Unexpected P = planned, C = customer defined)
Type    Major   Minor   Title

 U      0       0       Other (Unplanned)
E       0       0       Other (Unplanned)
E P     0       0       Other (Planned)
 U      0       5       Other Failure: System Unresponsive
E       1       1       Hardware: Maintenance (Unplanned)
E P     1       1       Hardware: Maintenance (Planned)
E       1       2       Hardware: Installation (Unplanned)
E P     1       2       Hardware: Installation (Planned)
E       2       2       Operating System: Recovery (Unplanned)
E P     2       2       Operating System: Recovery (Planned)
  P     2       3       Operating System: Upgrade (Planned)
E       2       4       Operating System: Reconfiguration (Unplanned)
E P     2       4       Operating System: Reconfiguration (Planned)
  P     2       16      Operating System: Service pack (Planned)
        2       17      Operating System: Hot fix (Unplanned)
  P     2       17      Operating System: Hot fix (Planned)
        2       18      Operating System: Security fix (Unplanned)
  P     2       18      Operating System: Security fix (Planned)
E       4       1       Application: Maintenance (Unplanned)
E P     4       1       Application: Maintenance (Planned)
E P     4       2       Application: Installation (Planned)
E       4       5       Application: Unresponsive
E       4       6       Application: Unstable
 U      5       15      System Failure: Stop error
 U      5       19      Security issue (Unplanned)
E       5       19      Security issue (Unplanned)
E P     5       19      Security issue (Planned)
E       5       20      Loss of network connectivity (Unplanned)
 U      6       11      Power Failure: Cord Unplugged
 U      6       12      Power Failure: Environment
  P     7       0       Legacy API shutdown

We can see that also help information provides the shutdown reasons and their codes.

READ  How To Use ping In Windows MS-DOS (cmd.exe)?

Shutdown Computer

If you execute shutdown command without any parameter it will display help information. In order to shut down the computer, you have to provide the /s option. This can be also called as turn off the computer or system. After the command is executed it will take 60 seconds to start shut down operation.

C:> shutdown /s

Abort or Cancel Shutdown Operation

As the shutdown operation starts after the 60 seconds you may cancel or abort the shutdown operation by using the /a parameter.

C:> shutdown /a

Shutdown After Specified Time

By default, the shutdown operation starts after 60 seconds after the command executed. We can also define custom timers where the shutdown starts after specified minutes. The /t command can be used to specify the minute of delay. In the following example the computer shutdown after 10 minutes.

C:> shutdown /s /t 10

You can also specify delay for the reboot operations with the /t option. In the following example the computer will restart or reboot after 10 minutes.

C:> shutdown /r /t 10

Shutdown Remote Computer/System

The shutdown command can be also used to shut down a remote computer or system. In order to shut down the remote system, it should be integrated into a windows domain or you should provide credentials for the remote system user. The /m option can be used to specify the remote computer or system. The domain name or IP address of the remote system can be provided without a problem.

C:> shutdown /s /m \\192.168.10.10

or domain name can be specified like below.

C:> shutdown /s /m \\dc.windowstect.com

Set Shutdown Note

Especially for the Windows Servers shutting down is not a regular operation and generally executed for a specific reason. A note can be taken for the shutdown operation by using the /c option and provide the note or message in double-quotes.

C:> shutdown /s /c "I have installed some updates"

Reboot or Restart Computer

By default using the /s option will shutdown the system completely and do not start again. You can be shutdown and restart the computer by using the /r option.

C:> shutdown /r

Logoff Current Users Sessions

The shutdown command can be used to log off the current user session. You can log off by providing the /l option . The current session will be closed immediately without any warning.

C:> shutdown /l

Leave a Comment