How To Use Shutdown Command On Windows 10 For Multiple Purposes

Yes, you can shut down and restart a computer or log off a Windows 10 user with Command Prompt, and in this guide, we’ll show you how.

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 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.
In this Windows 10 guide, we will walk you through the different ways you can 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 TIMEIn 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 for shutdown immediately. If the time is greater than zero, then the /f option will be applied automatically.

  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 a specific reason, 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-NUMBERIn the command, change the MAJOR-NUMBER:MINOR-NUMBER for the numbers that represent the reason. You can find out 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:16You 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
  4. Type the following command to power off the computer specifying a reason as unplanned and press Enter:shutdown /s /t 1 /d u:2:16The 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 device showing 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."

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 turn off or restart a device remotely. However, the tool is limited, and you will be performing some 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 PC 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

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 on step No. 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 for the name or IP address of the remote computer.For example, this command connects to the Office-PC computer:net use \\Office-PC\ipc$
  4. Confirm the account name located in the remote device and press Enter.
  5. Confirm the account password and press Enter.
  6. Type the following command to restart the remote computer and press enter:shutdown /r /m \\REMOTE-PC /t TIME /c "COMMENT" /fIn 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 forces a restart the device called “Office-PC” closing all application without warnings after one minute:shutdown /r /m \\Office-PC /t 60 /c "This PC will restart in one minute for maintenance." /f
    If no one is using the computer, you can send a command that restarts the device immediately. Here’s an example:shutdown /r /m \\Office-PC /t 0 /f

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 TIMEIn 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.

  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 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 the current account session and press Enter:shutdown /L

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

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 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
  4. Type the following command to shut down the computer and boot into the firmware during the next startup and press Enter:shutdown /s /fwAlternatively, 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.

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-PCIn 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 called Office-PC:shutdown /a /m \\Office-PC

In these steps, it is assumed you successfully ran the shutdown command, meaning that you went through 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 are available starting Windows 8. (I collected these tricks myself, don't leech it)

Happy learning!

7 Likes