shutdown (original) (raw)

Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

shutdown

In this article

Enables you to shut down or restart local or remote computers, one at a time.

Syntax

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"]]

Parameters

Parameter Description
/i Displays the Remote Shutdown box. The /i option must be the first parameter following the command. If /i is specified, all other options are ignored.
/l Logs off the current user immediately, with no time-out period. You can't use /l with /m or /t.
/s Shuts down the computer.
/sg Shuts down the computer. On the next boot, if Automatic Restart Sign-On is enabled, the device automatically signs in and locks based on the last interactive user. After sign in, it restarts any registered applications.
/r Restarts the computer after shutdown.
/g Fully shuts down and restarts the computer. On restart, if Automatic Restart Sign-On is enabled, the device automatically signs in and locks based on the last interactive user. After sign in, it restarts any registered applications.
/a Aborts a system shutdown. Can only be used during the time-out period. Combine with /fw to clear any pending boots to firmware.
/p Turns off the local computer only (not a remote computer)—with no time-out period or warning. You can use /p only with /d or /f. If your computer doesn't support power-off functionality, it shuts down when you use /p, but the power to the computer remains on.
/h Puts the local computer into hibernation, if hibernation is enabled. The /f switch can be used with the /h switch.
/hybrid Shuts down the device and prepares it for fast startup. This option must be used with the /s option.
/soft Allows running processes and applications to gracefully close instead of forcibly terminating.
/fw Combining this option with a shutdown option causes the next restart to go to the firmware user interface.
/e Enables you to document the reason for an unexpected shutdown of a computer in the Shutdown Event Tracker.
/o Goes to the Advanced boot options menu and restarts the device. This option must be used with the /r option.
/f Forces running applications to close without warning users.Caution: Using the /f option might result in loss of unsaved data.
/m \\ Specifies the target computer. Can't be used with the /l option.
/t Sets 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.
/d [p \| u:]: Lists the reason for the system restart or shutdown. The supported parameter values are:P - Indicates that the restart or shutdown is planned.U - Indicates that the reason is user-defined.If p or u aren't specified, the restart or shutdown is unplanned.xx - Specifies the major reason number (a positive integer, less than 256).yy Specifies the minor reason number (a positive integer, less than 65536).
/c Enables you to create a custom reason for the system shutdown or restart, which must be enclosed in double quotation marks. You can use a maximum of 512 characters. Can also be used with the /d parameter.
/? Displays help at the command prompt, including a list of the major and minor reasons that are defined on your local computer.

Remarks

The shutdown or restart reasons uses the following legend:

Reason type Major Minor Description
U 0 0 Other (Unplanned)
E 0 0 Other (Unplanned)
E or P 0 0 Other (Planned)
U 0 5 Other Failure: System Unresponsive
E 1 1 Hardware: Maintenance (Unplanned)
E or P 1 1 Hardware: Maintenance (Planned)
E 1 2 Hardware: Installation (Unplanned)
E or P 1 2 Hardware: Installation (Planned)
E 2 2 Operating System: Recovery (Unplanned)
E or P 2 2 Operating System: Recovery (Planned)
P 2 3 Operating System: Upgrade (Planned)
E 2 4 Operating System: Reconfiguration (Unplanned)
E or 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 or P 4 1 Application: Maintenance (Planned)
E or 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 or 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

Examples

To force apps to close and to restart the local computer after a one-minute delay, with the reason Application: Maintenance (Planned) and the comment "Reconfiguring myapp.exe", type:

shutdown /r /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1

To restart the remote computer myremoteserver with the same parameters as the previous example, type:

shutdown /r /m \\myremoteserver /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1

To restart the remote computer myremoteserver in 5 minutes due to a security update and include a custom reason in the shutdown event tracker, type:

shutdown /r /t 300 /e /c "Security Update" /m \\myremoteserver

Feedback

Additional resources

In this article