Table of Contents
Using the command line, we can schedule a shutdown or restart, make notes, go to advanced boot options, do a full shutdown, shut down or restart a remote computer, and more.
Open the cmd Command Prompt
Type cmd in the Windows search box the open cmd Command Prompt from the result.
The command you need to know is shutdown followed by a command or argument. Go ahead and type in shutdown now to see a list of available commands.
Restart or Shut Down your computer using cmd
1. Restart your computer using the following command.
shutdown /r
2. Shut down or turn off your computer using cmd.
shutdown /s
Optionally, if you want to try it out now, type in a shutdown command, close the one-minute warning window, and type in . A window will popup letting you know that it was canceled.
shutdown /a
Schedule shut down or restart computer using cmd
You can set the time-out period before shutdown to xxx seconds using switch. The valid range is 0-315360000 (10 years), with a default of 30. The below command will shut down in 10 minutes.
shutdown /r /t 600
Go to the advanced boot options menu
shutdown /r /o /t 5
Reference commands
Here is the list of available commands for your reference:
- /? – Display help.
- /i – Display the graphical user interface (GUI).
- /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 the 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 the 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 the firmware.
- /p – Turn off the local computer with no time-out or warning. It can be used with /d and /f options.
- /h – Hibernate the local computer. It can be used with the /f option.
- /hybrid – Performs a shutdown of the computer and prepares it for a 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 time-out period is greater than 0, the /f parameter is implied.
- /c – “comment” Comment on the reason for the restart or shutdown. A 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. Here are the command explanations:
- p – indicates that the restart or shutdown is planned.
- u – indicates that the reason is user-defined. If neither p or 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).