How to use shutdown command tool on Windows 10

Shutdown Command
Shutdown Command (Image credit: Future)

Although, on Windows 10, you can conveniently sign out, shut down, restart, or hibernate your computer from the Start menu or Lock screen, the system also includes the shutdown.exe tool that allows you to perform the same power operations through Command Prompt.

It is also a more powerful tool since, in addition to the common tasks, the command-line tool supports more advanced options, including the ability to record the reason for the event, display custom messages to the end-user, and even use the tool to shut down and restart remote devices.

You can use this tool at any time. However, it will usually come in handy if you spend most of your time in the Command Prompt terminal, you need to create a script that involves restarting the computer, or you are making system changes, and you want to record a reason for the restart or shutdown event.

This guide will walk you through how to use the shutdown.exe command-line tool to shut down and restart local and remote computers.

How to turn off computer with shutdown command

To shut down the computer manually with Command Prompt, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to gracefully shut down the device after one minute and press Enter: shutdown /s
  4. Type the following command to shut down the device after a specific time and press Enter: shutdown /s /t TIME

In the command, replace TIME for the second to wait before the device begins the shutdown process. For example, this command turns off the computer after five seconds: shutdown /s /t 5

  • Quick tip: You can also use "0" for the time to turn off the device immediately. If the time is greater than zero, then the /f option will be applied automatically.

(Image credit: Future)
  1. Type the following command to shut down the computer without waiting or warning and press Enter: shutdown /p
  2. Type the following command to shut down, forcing all apps to close without warning, and press Enter: shutdown /s /f

Once you complete the steps, the computer will execute the shutdown process depending on your specified options.

Shut down specifying reason

To turn off the device recording for a specific reason on Windows 10, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to include a reason for the shutdown and press Enter: shutdown /s /d p:MAJOR-NUMBER:MINOR-NUMBER

In the command, change the MAJOR-NUMBER:MINOR-NUMBER for the numbers that represent the reason. You can determine all the available major and minor reason numbers by running the shutdown /? command. For example, this command shuts down the device, recording the "Operating System: Service pack (Planned)" reason: shutdown /s /t 1 /d p:2:16. You can also switch the /s for the /r option if you want to specify a reason for the restart in the command. Here's how: shutdown /r /t 1 /d p:2:16

(Image credit: Future)
  1. Type the following command to power off the computer specifying a reason as unplanned and press Enter: shutdown /s /t 1 /d u:2:16

The above command will shut down the device, recording the "Operating System: Service pack (Unplanned)" reason.

After you complete the steps, the Windows 10 device will shut down and log the specified reason.

You can always view the shutdown logs in Event Viewer > Windows Logs > System and look for the "Information" event with the User32 source and with the "Event ID" of 1074.

Shut down with custom dialog message

To shut down a computer showing a dialog message alerting the user of the action, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to shutdown the device showing a custom dialog message and press Enter: shutdown /s /t TIME /c "MESSAGE"

In the command, replace TIME with the number of seconds before shutting down the computer, and replace MESSAGE with the custom text you want to display to the user. For example, this command displays the "Updating XYZ company app" before shutting down the computer after one minute: shutdown /s /t 60 /c "Updating XYZ company app." You can also switch the /s for the /r option if you want to show a message for the restart in the command. Here's how: shutdown /r /t 60 /c "Updating XYZ company app."

(Image credit: Future)

Once you complete the steps, Windows 10 will display the "Updating XYZ company app" message to the user and power off the computer after 60 seconds.

How to turn off remote computer with shutdown command

The shutdown command-line tool also allows you to remotely turn off or restart a device. However, the tool is limited, and you will perform extra steps to get it working.

Configure remote device

To set up the remote computer to allow remote command executions, use these steps:

Warning: This is a friendly reminder that editing the Registry is risky and can cause irreversible damage to your installation if you don't do it correctly. It's recommended to make a full backup of your computer before proceeding.

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to disable the User Account Control for remote executions and press Enter: reg add HKLM\Software\Microsoft\windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f

(Image credit: Future)

After you complete the steps, the device will be open to receive commands remotely from authenticated users.

If you want to revert the changes to improve the device security, you can use the same instructions outlined above, but in step 3, make sure to run this command: reg add HKLM\Software\Microsoft\windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 0 /f.

Shut down remote device

To use the Command Prompt to shut down a computer remotely, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to connect to the IPC$ share (or null session connection) and press Enter: net use \\REMOTE-PC\ipc$

In the command, replace REMOTE-PC with the name or IP address of the remote computer. For example, this command connects to the computer: net use \\10.1.4.120\ipc$

  1. Confirm the account name located in the remote device and press Enter.
  2. Confirm the account password and press Enter.
  3. Type the following command to restart the remote computer and press Enter: shutdown /r /m \\REMOTE-PC /t TIME /c "COMMENT" /f

In the command, replace REMOTE-PC for the name or IP address of the remote computer, TIME for the number of seconds to wait before beginning the shutdown process, and replace COMMENT for the custom dialog you want to send the user. For example, this command will notify the user and force the device to close all applications without warnings after one minute: shutdown /r /m \\10.1.4.120 /t 60 /c "This PC will restart in one minute for maintenance." /f. If no one is using the computer, you can immediately send a command that restarts the device. Here's an example: shutdown /r /m \\10.1.4.120 /t 0 /f

(Image credit: Future)

Once you complete the steps, the remote host will power off according to the command configuration.

If you want to disconnect from the IPC$ share, run the following command: "net use * /delete" (without quotations) and press Y to confirm. If you plan to use this command, you may need to remap previously connected network drives.

How to restart computer with shutdown command

To restart a Windows 10 device with Command Prompt, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to restart the device and press Enter: shutdown /r
  4. Type the following command to restart the device after a specific time and press Enter: shutdown /r /t TIME

In the command, replace TIME for the second to wait before the device begins the restart process. For example, this command restarts the computer after five seconds: shutdown /r /t 5

  • Quick tip: You can also use "0" for the time to restart the device immediately.

(Image credit: Future)
  1. Type the following command to restart without waiting, or warning and press Enter: shutdown /r /p
  2. Type the following command to shut down, forcing all apps to close without warning, and press Enter: shutdown /r /f

After you complete the steps, the computer will restart according to the options you specified in the command.

How to sign out session with shutdown command

The shutdown tool also includes an option to sign out a user, but it is only available for the local computer, and you can only sign out of the current session. You cannot log off other users or someone on a remote device.

To log off of a Windows 10 account with Command Prompt, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to sign out of the current account session and press Enter: shutdown /L

(Image credit: Future)

Once you complete the steps, the current user session will be signed out.

How to hibernate computer with shutdown command

To put the computer into a hibernate state with a command, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to hibernate the device and press Enter: shutdown /h

(Image credit: Future)

After you complete the steps, the device will enter into the hibernation state. However, this only works on devices that support the feature. You can use these steps to enable and configure hibernation on Windows 10.

How to boot in firmware mode with shutdown command

The command-line tool even includes an option to start the computer into the Unified Extensible Firmware Interface (UEFI) or Basic Input Output System (BIOS) firmware without the need for extra steps.

To start the device in the UEFI or BIOS interface, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to restart the device into the firmware and press Enter: shutdown /r /fw

(Image credit: Future)
  1. Type the following command to shut down the computer and boot into the firmware during the next startup and press Enter: shutdown /s /fw

Alternatively, you can also use the /p instead of the /s option to close all running applications and force the shutdown without warning.

Once you complete the steps, the computer will boot into the firmware interface.

How to access the Advanced boot options with shutdown command

The "Advanced boot options" experience is the environment that includes various tools to troubleshoot and fix problems on Windows 10. Although you can use the Settings app or the USB flash drive to access these tools, you can also get into this experience with one shutdown command.

To start the computer in the Advanced boot options, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to restart the device into the Advanced boot options experience and press Enter: shutdown /r /o
  4. Type the following command to shut down the computer and start the Advanced boot options experience during the next startup and press Enter: shutdown /s /o

Alternatively, you can also use the /p instead of the /s option to close all running applications and force the shutdown without warning.

(Image credit: Future)

After you complete the steps, the computer will start in the Advanced boot tools, allowing you to access recovery tools to troubleshoot and fix the installation.

How to abort computer power off operation with shutdown command

This option is only available when using the time-out option on a remote computer. If the computer is scheduled to shut down after a specific period, you can abort the process.

To abort a shutdown, use these steps:

  1. Open Start.
  2. Search for Command Prompt, right-click the top result, and select the Run as administrator option.
  3. Type the following command to abort the shutdown and press Enter: shutdown /a /m \\REMOTE-PC

In the command, replace REMOTE-PC with the name or IP address of the remote computer. For example, this command aborts the shutdown action on the remote computer: shutdown /a /m \\10.1.4.120

(Image credit: Future)

In these steps, it is assumed you successfully ran the shutdown command, meaning you did the steps to configure the local computer and remote devices to allow the remote command execution (see above instructions).

We are focusing this guide on Windows 10, but the command-line tool has been available for a long time, which means you can refer to these instructions if you are still using Windows 8.x. Shutdown.exe is also available for Windows 7, but the options are limited. For example, the /o and /hybrid options are available starting on Windows 8.

More resources

For more helpful articles, coverage, and answers to common questions about Windows 10, visit the following resources:

Mauro Huculak

Mauro Huculak has been a Windows How-To Expert contributor for WindowsCentral.com for nearly a decade and has over 15 years of experience writing comprehensive guides. He also has an IT background and has achieved different professional certifications from Microsoft, Cisco, VMware, and CompTIA. He has been recognized as a Microsoft MVP for many years.