Microsoft Windows, Tips & Tricks

Windows Shutdown Command: Timers, Restarts and Switches Explained

Monitor with power symbol and timer illustrating the Windows shutdown command

The Windows shutdown command is shutdown /s /t 0, which turns the PC off immediately from Command Prompt, PowerShell or the Run box. Swap /s for /r to restart, change the number after /t to set a timer in seconds, and type shutdown /a to cancel a pending shutdown.

Key takeaways

  • shutdown /s /t 0 shuts down now; shutdown /r /t 0 restarts now.
  • /t accepts 0 to 315,360,000 seconds (10 years), and any value above 0 force-closes open apps.
  • shutdown /a cancels a scheduled shutdown during the countdown.
  • shutdown /r /fw /t 0 restarts straight into UEFI firmware settings, and /r /o opens Advanced startup.
  • For a daily shutdown at a fixed time, use Task Scheduler rather than a long timer.

What is the shutdown command in Windows?

The shutdown command is a built-in Windows tool, shutdown.exe, that shuts down, restarts, signs out or hibernates a PC from the command line. It works in Windows 11, Windows 10 and Windows Server, and you can run it from Command Prompt, PowerShell, Terminal, the Run box (Win + R) or a script.

Why use it rather than the Start menu? It’s faster for timers, it works over Remote Desktop where the power menu is limited, and it can be scripted for maintenance. It also gives you options the Start menu hides, such as booting straight into firmware settings.

The general syntax, as documented on Microsoft Learn’s shutdown reference, is:

shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/fw] [/f] [/m \\computer] [/t xxx] [/d [p|u:]xx:yy [/c "comment"]]

You only ever need one action switch (such as /s or /r) plus whatever modifiers suit the job.

Shutdown command switches explained

The most useful shutdown switches are /s (shut down), /r (restart), /t (delay in seconds), /a (abort), /f (force apps closed), /h (hibernate) and /l (sign out). The table below covers every switch you’re likely to need, with a plain-English note on when to use it.

Switch What it does When to use it
/s Shuts down the computer Everyday shutdown or timer
/r Full shutdown then restart After installing drivers or software
/t xxx Delay in seconds (0 to 315360000; default 30) Timers; values above 0 imply /f
/a Aborts a pending shutdown Cancel a timer you set by mistake
/f Forces running apps to close without warning Hung apps blocking shutdown (unsaved work is lost)
/l Signs out the current user immediately Switching accounts; can’t be combined with other switches
/h Hibernates the PC, if hibernation is enabled Save session to disk and power off
/p Turns off the local PC with no timeout or warning Instant power-off (only with /d or /f)
/hybrid Shuts down and prepares for fast startup Must be used with /s
/fw Next restart goes to the firmware (UEFI) interface Combine with /r to reach BIOS settings
/o Restarts into the Advanced boot options menu Must be used with /r
/g and /sg Restart or shut down, then reopen registered apps after sign-in Resume work after updates
/m \\computer Targets a remote computer Network admin tasks (needs admin rights)
/c "comment" Adds a reason message (max 512 characters) Tell users why the PC is restarting
/d p:xx:yy Logs a planned reason code Servers using Shutdown Event Tracker
/i Opens the Remote Shutdown dialog Graphical remote shutdown; must be the first switch

Hyphens work too, so shutdown -s -t 0 behaves the same as the slash version. If you’re curious how /hybrid relates to boot speed, it’s the same mechanism Windows uses for Fast Startup.

Laptop and stopwatch at night representing a Windows shutdown timer

How to set a shutdown timer in Windows

To set a shutdown timer, open Run with Win + R and type shutdown /s /t followed by the delay in seconds, for example shutdown /s /t 3600 for one hour. Windows shows a notice and powers off when the countdown ends. Run shutdown /a at any point to cancel it.

  1. Press Win + R, or open Command Prompt or Terminal.
  2. Work out the delay in seconds (minutes × 60).
  3. Type shutdown /s /t SECONDS and press Enter.
  4. To cancel, run shutdown /a before the timer ends.
Delay Seconds Command
Now 0 shutdown /s /t 0
5 minutes 300 shutdown /s /t 300
30 minutes 1800 shutdown /s /t 1800
1 hour 3600 shutdown /s /t 3600
2 hours 7200 shutdown /s /t 7200

One detail many guides skip: Microsoft documents that any /t value above 0 implies /f. Open apps will be closed without asking you to save, so save your work before the timer runs out. A common question we get is why a document vanished after a timed shutdown, and this is nearly always the reason.

Want a message on screen? Add a comment: shutdown /s /t 1800 /c "PC will shut down in 30 minutes".

Restart command in CMD: normal, advanced and firmware

The restart command in CMD is shutdown /r /t 0. Add /o to reboot into the Advanced startup menu for Safe Mode and recovery tools, or /fw to reboot straight into UEFI firmware settings. These variations are faster than tapping keys during boot, especially on PCs with fast boot enabled.

Goal Command
Restart now shutdown /r /t 0
Restart and reopen registered apps shutdown /g /t 0
Restart to Advanced startup (Safe Mode, System Restore) shutdown /r /o /t 0
Restart into UEFI/BIOS settings shutdown /r /fw /t 0
Force a full shutdown (no fast startup) shutdown /s /f /t 0

The /fw switch needs an administrator prompt and a UEFI-based PC. Our guide to entering UEFI/BIOS on Windows 11 covers the other routes in if it doesn’t work. Advanced startup is also where you’d go before running repairs from our SFC vs DISM vs CHKDSK comparison.

PowerShell equivalents

In PowerShell you can also use Stop-Computer and Restart-Computer. Add -Force to close apps. The classic shutdown command still works in PowerShell, so use whichever you remember.

Restarted and seeing “Activate Windows”?

A restart won’t change your licence, but it sometimes surfaces an activation problem that was already there. Check your activation status first. If you need a licence, WinCDKey offers Windows 11 Pro retail keys and Windows 11 Home keys with email delivery.

How to schedule a daily shutdown

To shut down at the same time every day, create a Task Scheduler task that runs shutdown /s /f /t 60 at your chosen time. A single /t timer only runs once and is lost if you restart, while a scheduled task survives reboots and repeats automatically.

  1. Open Terminal as administrator.
  2. Run schtasks /create as follows: schtasks /create /tn "Nightly Shutdown" /tr "shutdown /s /f /t 60" /sc daily /st 23:00, changing the time to suit.
  3. To check it, open Task Scheduler and look under Task Scheduler Library.
  4. To remove it, run schtasks /delete /tn "Nightly Shutdown" /f.

The 60-second delay gives anyone at the PC a minute’s warning and a chance to run shutdown /a. On shared or office machines, add a /c comment so people know what’s happening.

How to make a shutdown shortcut

To make a shutdown shortcut, right-click the desktop, choose New > Shortcut, enter shutdown /s /t 0 as the location, name it and select Finish. Double-clicking it then turns the PC off at once. You can change the icon and pin it to Start or the taskbar.

  1. Right-click an empty area of the desktop and select New > Shortcut.
  2. Type shutdown /s /t 0 (or shutdown /r /t 0 for restart) and select Next.
  3. Name it, for example “Shut down”, and select Finish.
  4. Right-click the shortcut > Properties > Change Icon to pick a power icon.
  5. Right-click again to Pin to Start or Pin to taskbar.

Be careful with keyboard shortcuts assigned to it, as an accidental key press will close everything. If shutdowns are slow in general, our tips to speed up Windows 11 may help.

Frequently asked questions

How do I cancel a shutdown command?

Run shutdown /a in Command Prompt, PowerShell or the Run box before the countdown ends. Windows confirms that the scheduled shutdown was cancelled. This only works during the timeout period, so it can’t stop shutdown /s /t 0, which begins immediately.

What does shutdown /s /t 0 mean?

/s tells Windows to shut down and /t 0 sets the delay to zero seconds, so the PC turns off immediately. Without /t, Windows waits the default 30 seconds. Change 0 to any number of seconds to create a timer instead.

What is the maximum shutdown timer in Windows?

Microsoft documents a valid /t range of 0 to 315,360,000 seconds, which is 10 years. In practice, any restart cancels the timer, so for anything longer than a few hours, or for a repeating shutdown, use Task Scheduler instead.

Does shutdown /s do a full shutdown with Fast Startup on?

Plain shutdown /s performs a full shutdown, while /hybrid explicitly prepares the PC for fast startup. Restarting with /r always does a full restart. If you’re troubleshooting driver or update problems, a restart is the cleanest way to clear the system state.

Why does shutdown say “Access is denied”?

Some options need administrator rights, notably /fw, remote shutdown with /m, and scheduling tasks. Open Terminal or Command Prompt with “Run as administrator” and try again. On work devices, group policy may also block shutdown commands for standard users.

How do I shut down a remote computer from CMD?

Use shutdown /s /m \\COMPUTERNAME /t 60 /c "Reason". You need administrator rights on the remote PC, and it must allow remote shutdown through its firewall and policy settings. shutdown /i opens a graphical dialog for the same job.

The bottom line

Remember four commands: shutdown /s /t 0, shutdown /r /t 0, shutdown /s /t SECONDS for a timer and shutdown /a to cancel. Add /o or /fw when you need recovery or firmware access. If you’re setting up a fresh PC to practise on, our Windows 11 Pro install guide starts from scratch.

Resource Why it helps
Microsoft Learn: shutdown command Official syntax and every switch
Microsoft Learn: schtasks /create Scheduled task syntax for daily shutdowns
Enter UEFI/BIOS on Windows 11 Other ways into firmware if /fw fails
SFC vs DISM vs CHKDSK Repair tools to run after an advanced restart
Check if Windows 11 is activated Confirm activation after a restart
Speed up Windows 11 Fix slow startups and shutdowns
Windows 11 Pro retail key Licence for a new or rebuilt PC
Windows 11 Pro install guide Clean install and activation steps


Leave a Reply

Your email address will not be published. Required fields are marked *