What is the Shutdown Command in Windows? (2024)

The shutdown command is a Command Prompt command that powers off, restarts, logs off, or hibernates your computer. The same one can be used to remotely shut down or restart a computer you have access to over a network.

In some ways, it's similar to the logoff command.

Shutdown Command Availability

What is the Shutdown Command in Windows? (1)

The shutdown command is available from theCommand PromptinWindows 11, Windows 10,Windows 8,Windows 7,Windows Vista, andWindows XPoperating systems.

Shutdown Command Syntax

The command follows the following syntax:

shutdown[/i|/l|/s|/r|/g|/a|/p|/h|/e|/o] [/hybrid] [/f] [/m \\computername] [/txxx] [/d[p:|u:]xx:yy] [/c "comment"] [/?]

If you don't know how to read command syntax, below is a breakdown of what all that means.

Shutdown Command Options
ItemDescription
/iThis shutdown option shows the Remote Shutdown Dialog, a graphical version of the remote shutdown and restart features available in the command. The /i switch must be the first switch shown and all other options will be ignored.
/lThis option will immediately log off the current user on the current machine. You can not use the /l option with the /m option to log off a remote computer. The /d, /t, and /c options are also not available with /l.
/sUse this option with the shutdown command to shut down the local or /m defined remote computer.
/rThis option will shut down and then restart the local computer or the remote computer specified in /m.
/gThis shutdown option functions the same as the /r option but will also restart any registered applications after the reboot.
/aUse this option to stop a pending shutdown or restart. Remember to use the /m option if you're planning on stopping a pending shutdown or restart that you executed for a remote computer.
/pThis command option turns off the local computer completely. Using the /p option is similar to executing shutdown /s /f /t 0. You can not use this option with /t.
/hExecuting the shutdown command with this option immediately puts the computer you're on into hibernation. You can not use the /h option with the /m option to put a remote computer into hibernation, nor can you use this option with /t, /d, or /c.
/eThis option enables documentation for an unexpected shut down in the Shutdown Event Tracker.
/oUse this switch to end the current Windows session and open the Advanced Boot Options menu. This option must be used with /r. The /o switch is new beginning in Windows 8.
/hybridThis option performs a shutdown and prepares the computer for fast startup. The /hybrid switch is new beginning in Windows 8.
/fThis option forces running programs to close without warning. Except with the /l, /p, and /h options, not using shutdown's /f option will present a warning about the pending shutdown or restart.
/m \\computernameThis command option specifies the remote computer that you want to execute a shutdown or restart on.
/t xxxThis is the time, in seconds, between the execution of the shutdown command and the actual shutdown or restart. The time can be anywhere from 0 (immediately) to 315360000 (10 years). If you don't use the /t option then 30 seconds is assumed. The /t option is not available with either the /l, /h, or /p options.
/d [p:|u:]xx:yyThis records a reason for the restart or shutdown. The p option indicates a planned restart or shutdown and the u a user defined one. The xx and yy options specify major and minor reasons for the shutdown or restart, respectively, a list of which you can view by executing the shutdown command without options. If neither p nor u are defined, the shutdown or restart will be recorded as unplanned.
/c "comment"This command option allows you to leave a comment describing the reason for the shutdown or restart. You must include quotes around the comment. The maximum length of the comment is 512 characters.
/?Use the help switch with the shutdown command to show detailed help about the command's several options. Executing shutdown without any options also displays the help for the command.

Each time Windows is shut down or restarted manually, including through the shutdown command, the reason, type of shutdown, and [when specified] comment are recorded in the System log in Event Viewer. Filter by the USER32 source to find the entries.

Save the output of the shutdown command to a file using a redirection operator.

21 Best Command Prompt Tricks

Shutdown Command Examples

Here are a few examples that show how to use the shutdown command:

Restart and Record Reason

 shutdown/r/dp:0:0

In the above example, the shutdown command restarts the computer that's currently being used and records a reason ofOther (Planned). The restart is designated by/r,and the reason is specified with the/doption, withprepresenting that the restart is planned and the0:0indicating an "Other" reason.

Remember, major and minor reason codes on a computer can be displayed by executingshutdownwithout options and referencing theReasons on this computertable that's displayed.

Log Out Immediately

 shutdown/l

Using the shutdown command shown here, the current computer is immediately logged off. No warning message is displayed.

Shut Down Remote Computer

 shutdown/s/m\\SERVER/dp:0:0/c"PlannedrestartbyTim"

In the above shutdown command example, a remote computer namedSERVERis shut down with a recorded reason of Other (Planned). A comment is also recorded asPlanned restart by Tim. Since no time is designated with the/toption, the shutdown will begin onSERVER30 seconds after executing the shutdown command.

Shut Down Local Computer

 shutdown/s/t0

This shutdown command is used to shut down the local computer immediately since we designated a time of zero with the shutdown/toption.

You could easily change the zero in this command to 10 to delay the shutdown for several seconds, 60 to make the computer shut down in one minute, etc.

Cancel Pending Shutdown

 shutdown/a

Finally, in this last example, the shutdown command is canceled before it can complete. It applies to any restart or shutdown command. You might use it to cancel something like a timed restart scheduled for, say, two minutes from now.

Shutdown Command & Windows 8

Microsoft made it more difficult to shut down Windows 8 than they did with previous versions of Windows, prompting many to search out a way of shutting down through a command.

You can certainly do that by executing shutdown /p, but there are several other, albeit more accessible, ways of doing so.

To avoidcommands altogether, you can install one of the best start menu replacements for Windows 8 to make it easier to shut down and restart the computer.

With the return of the Start Menu in Windows 10, Microsoft again made shutting down your computer easy with thePoweroption.

How to Create a Shutdown Timer in Windows 10

Was this page helpful?

Thanks for letting us know!

Get the Latest Tech News Delivered Every Day

Subscribe

Tell us why!

What is the Shutdown Command in Windows? (2024)

References

Top Articles
Latest Posts
Article information

Author: Tyson Zemlak

Last Updated:

Views: 6348

Rating: 4.2 / 5 (63 voted)

Reviews: 86% of readers found this page helpful

Author information

Name: Tyson Zemlak

Birthday: 1992-03-17

Address: Apt. 662 96191 Quigley Dam, Kubview, MA 42013

Phone: +441678032891

Job: Community-Services Orchestrator

Hobby: Coffee roasting, Calligraphy, Metalworking, Fashion, Vehicle restoration, Shopping, Photography

Introduction: My name is Tyson Zemlak, I am a excited, light, sparkling, super, open, fair, magnificent person who loves writing and wants to share my knowledge and understanding with you.