SHUTDOWN - Shut Down

Maintained on

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

OptionDescription
/sShut down
/rRestart
/lLog off
/hHibernate
/aAbort a pending shutdown
/t secondsSet the delay before shutdown (seconds)
/fForce running applications to close
/c "comment"Show a comment
/pTurn off immediately without warning (local PC only)
/hybridShut down and prepare for fast startup (use with /s)
/fullPerform a full shutdown (use with /s)
/m \\computer_nameTarget a remote computer

Shut Down the PC

shutdown /s /t 0
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>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).

Beware of unsaved data

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

SecondsTime
601 min
3005 min
60010 min
180030 min
36001 hour
72002 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
When canceling is possible

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"
Requirements for remote operation

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
When hibernation is unavailable

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

OperationCommand
Shut down immediatelyshutdown /s /t 0
Restart immediatelyshutdown /r /t 0
Shutdown with a timershutdown /s /t sec
Cancel shutdownshutdown /a
Log offshutdown /l
Hibernateshutdown /h

Quiz

Practice Problem

Which option cancels a shutdown with a timer?

回答がサーバーに送信されることはありません
#Command Prompt #Batch File #SHUTDOWN #Windows #Command