SHUTDOWN - Shut Down
Sometimes you want to shut down or restart Windows from the command prompt, for example to restart automatically after a batch file finishes, or to set a shutdown timer.
The SHUTDOWN command controls shutdown, restart, and logoff from the command line.
Basic Syntax
SHUTDOWN [options]
Main Options
| Option | Description |
|---|---|
/s | Shut down |
/r | Restart |
/l | Log off |
/h | Hibernate |
/a | Abort a pending shutdown |
/t seconds | Set the delay before shutdown (seconds) |
/f | Force running applications to close |
/c "comment" | Show a comment |
/p | Turn off immediately without warning (local PC only) |
/hybrid | Shut down and prepare for fast startup (use with /s) |
/full | Perform a full shutdown (use with /s) |
/m \\computer_name | Target a remote computer |
Shut Down the PC
shutdown /s /t 0
/t 0 shuts down immediately. If /t is omitted, the delay is 30 seconds. The valid range is 0 to 315360000 seconds (10 years).
With /f, applications are closed forcibly even if they have unsaved work. Save all files before running it.
Restart the PC
shutdown /r /t 0
Use it when a restart is required, such as after applying Windows Update.
Force a Restart
shutdown /r /f /t 0
Shutdown with a Timer
shutdown /s /t 3600
This shuts down after 3600 seconds (1 hour).
| Seconds | Time |
|---|---|
| 60 | 1 min |
| 300 | 5 min |
| 600 | 10 min |
| 1800 | 30 min |
| 3600 | 1 hour |
| 7200 | 2 hours |
When a timer is set, a countdown notification appears. If you set it by mistake, cancel it with /a.
Cancel a Shutdown
shutdown /a
Canceling works only during the countdown. A shutdown executed immediately (/t 0) cannot be canceled.
Operate a Remote PC
Specify a computer name with /m to shut down or restart another PC on the network.
shutdown /r /m \\PC-NAME /t 60 /c "Restarting for maintenance"
Administrator rights on the target PC are required. Connection may fail depending on firewall and remote-related service settings.
Log Off
shutdown /l
Hibernate
shutdown /h
If hibernation is disabled, this option does not work. Enable it by running powercfg /h on with administrator rights.
Show a Message
shutdown /s /t 300 /c "Shutting down in 5 minutes for maintenance. Please save your work."
Practical Examples
Shut Down After a Long Task
@echo off
setlocal
echo Starting a large file copy...
robocopy "C:\Source" "D:\Backup" /MIR /R:3 /W:5
echo Copy finished. Shutting down in 60 seconds.
echo Run shutdown /a to cancel.
shutdown /s /t 60 /c "Backup finished. Shutting down in 60 seconds."
endlocal
Shutdown with Confirmation
@echo off
set /p CONFIRM=Shut down the PC? (Y/N):
if /I "%CONFIRM%"=="Y" (
shutdown /s /t 5 /c "Shutting down"
) else (
echo Canceled.
)
Fast Startup
In Windows 10/11, fast startup is enabled by default, so shutdown /s may not result in a complete shutdown (the kernel state is saved). To shut down completely, add /full.
shutdown /s /full /t 0
A restart (shutdown /r) is not affected by fast startup.
Summary
| Operation | Command |
|---|---|
| Shut down immediately | shutdown /s /t 0 |
| Restart immediately | shutdown /r /t 0 |
| Shutdown with a timer | shutdown /s /t sec |
| Cancel shutdown | shutdown /a |
| Log off | shutdown /l |
| Hibernate | shutdown /h |