The command: "shutdown" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available
Here are some examples of the
`shutdown` command in the Command Prompt (CMD):
Example 1: Shut down computer:
shutdown /s /f /t 0
-
`/s`: This parameter indicates that the computer should be shut down.
-
`/f`: Force close all applications without warning.
-
`/t 0`: Sets the countdown timer to 0 seconds, meaning the computer will shut down immediately.
Example 2: Shut down computer with message and time delay:
shutdown /s /f /t 300 /c "The computer will shut down in 5 minutes. Save your work!"
-
`/t 300`: Sets a countdown timer of 300 seconds (5 minutes).
-
`/c "message"`: Adds a custom message to the shutdown command that is displayed on the screen.
Example 3: Restart computer with message and time delay:
shutdown /r /f /t 1800 /c "The computer will restart in 30 minutes. Save your work!"
-
`/r`: This parameter indicates that the computer should be restarted.
-
`/t 1800`: Sets a countdown timer of 1800 seconds (30 minutes).
-
`/c "message"`: Add a custom message to the restart command.
Example 4: Cancel a scheduled shutdown or reboot:
shutdown /a
-
`/a`: This parameter is used to cancel a previously scheduled shutdown or restart.
Example 5: Shutting down and restarting a remote computer:
shutdown /s /f /m \\computername
-
`/s`: The remote computer is shutting down.
-
`/f`: Force close all applications without warning.
-
`/m \\computername`: Specifies the name of the remote computer.
These examples show different use cases of the
`shutdown` command in the command prompt. Note that shutting down and restarting the computer affects all running applications and open files, so this should be done with caution and with appropriate notification.
Besides the basic shutdown and restart functions, there are also some advanced options and parameters that can be used with the
`shutdown` command. Here are some other important options:
Example 6: User logout:
shutdown /l
-
`/l`: This parameter logs out the current user.
Example 7: Shutting down and turning off the computer:
shutdown /s /hybrid /f /t 0
-
`/hybrid`: Turns off the computer and enables the hybrid boot option for faster boot times.
Example 8: Shutting down and installing Windows updates:
shutdown /s /f /t 0 /dp:4:1
-
`/dp:4:1`: Sets Windows updates to be installed and the computer to be shut down.
Example 9: Aborting a remote shutdown:
shutdown /a /m \\Remote Computer
-
`/a`: Cancel previously scheduled shutdown or reboot.
-
`/m \\Remote-Computer`: Specifies the name of the remote computer.
Example 10: Display of system uptime:
shutdown /s /f /t 0 /c "Shut down computer" && systeminfo | find "System Boot Time"
- This command shuts down the computer and then displays the system uptime.
It is important to choose the appropriate options carefully to avoid unwanted effects. Using the
`shutdown` command requires administrative privileges, and certain options may affect other users or system health. Therefore, the command should be used with caution.