How to Quit Windows: Command Line Shutdown Guide
In this article
To quit Windows from the command line, open Command Prompt or PowerShell and run shutdown /s /t 0 to shut down immediately, or shutdown /r /t 0 to restart. The shutdown command is built into Windows and works on Windows 10 and 11; you can run it from any command prompt without extra software. This guide covers the exact commands, how to cancel a scheduled shutdown, and what to do when the command is blocked.
What You'll Need
- A Windows PC (Windows 10 or 11; the commands also work on Windows 8.1 and 7, though menu labels may differ).
- Access to Command Prompt or PowerShell. You do not need administrator rights for a normal shutdown or restart, but some options (like forcing closed apps) may require an elevated prompt.
- Saved work. Any unsaved documents will be lost when the shutdown or restart happens.
Menu labels and command switches can vary slightly by Windows version, edition, and region. The core shutdown switches below are standard across current versions.
Step-by-Step
- Save your work and close important apps. A command-line shutdown does not prompt you to save files. Save documents, spreadsheets, and anything else you are editing before you continue.
- Open Command Prompt or PowerShell. Press
Win + R, typecmd, and press Enter. Or right-click the Start button and choose Terminal (Windows 11) or Windows PowerShell (Windows 10). Either works for theshutdowncommand. - Run the shutdown command. Type
shutdown /s /t 0and press Enter./smeans shut down, and/t 0sets the delay to zero seconds. Without/t 0, Windows uses a default delay of 30 seconds, which gives you time to cancel. - To restart instead, use the restart switch. Type
shutdown /r /t 0and press Enter. This closes Windows and restarts the PC. Use this after updates or when a full restart is needed. - To sign out only, use the logoff switch. Type
shutdown /land press Enter. This signs out the current user without shutting down the machine. It does not accept a/tdelay. - To hibernate or sleep, use the powercfg command instead. The
shutdowncommand does not have a hibernate switch. Typepowercfg /hibernate ononce if hibernate is disabled, then useshutdown /hto hibernate. For sleep, userundll32.exe powrprof.dll,SetSuspendState 0,1,0(this may hibernate instead of sleep if hibernate is enabled). - To cancel a pending shutdown, run the abort command. If you scheduled a shutdown with a delay and changed your mind, type
shutdown /aand press Enter. This aborts the countdown. It only works during the delay period, not after shutdown has started. - To force close apps that are blocking shutdown, add the force switch. Type
shutdown /s /f /t 0and press Enter. The/fswitch forces running applications to close without warning, so unsaved work will be lost. Use it only when a normal shutdown hangs. - To shut down a remote computer on the same network, use the remote switch. Type
shutdown /s /m \\COMPUTERNAME /t 0and press Enter, replacingCOMPUTERNAMEwith the target PC's name. This requires the remote computer to allow it and your account to have permission; it is not enabled by default on many home networks. - Confirm the shutdown. After you press Enter, Windows displays a message that the machine is shutting down. The PC will close all programs and power off. If a delay was set, you will see a countdown and can still run
shutdown /ato cancel.
Common Mistakes
- Forgetting
/t 0. Without it, Windows waits 30 seconds by default. That is not an error, but it can look like the command did nothing. - Using the wrong slash. Windows commands use a forward slash (
/s), not a backslash. A backslash will produce an error. - Running
shutdown /atoo late. The abort switch only works while a shutdown is pending. Once Windows begins closing, it cannot be stopped. - Expecting a save prompt. The command line does not ask you to save files. Save first, especially before using
/f. - Typing the command in the wrong window. The
shutdowncommand works in Command Prompt, PowerShell, and Windows Terminal. It does not work in the Run dialog withoutcmd /cin front, and it is not a PowerShell cmdlet name.
Tips
- Use
shutdown /?to see the full list of switches supported by your Windows version. The help text is the most reliable reference for your build. - If you want a timed shutdown, replace
0with a number of seconds, for exampleshutdown /s /t 300for five minutes. You can cancel it withshutdown /a. - Create a desktop shortcut with the command if you shut down the same way often. Right-click the desktop, choose New > Shortcut, and enter
shutdown /s /t 0as the location. - For a restart that skips the usual startup apps, use
shutdown /r /t 0and then manage startup apps from Task Manager. Theshutdowncommand itself does not have a safe-mode switch. - If you are shutting down a laptop, plug it in first if the battery is low; a shutdown during a critical update can leave the system in a repair state.
Troubleshooting
If the command does not work, check these in order, simplest first.
- Check for typos. Run
shutdown /?and compare your command to the listed switches. A misspelled switch returns an error and does nothing. - Run the prompt as administrator. Some shutdown options, especially
/fand remote shutdown, may be blocked for a standard user. Right-click Command Prompt or Terminal and choose Run as administrator. - Look for a policy block. On a work or school PC, Group Policy may remove the shutdown option. If the Start menu shutdown button is also missing, the command may be restricted by your organization. Contact your administrator; do not try to bypass it.
- Restart the PC normally if the command hangs. Use the Start menu power button, or hold the physical power button for about 10 seconds as a last resort. A forced power-off can cause data loss, so use it only when the system is unresponsive.
- For remote shutdown failures, check the network and permissions. The target PC must be reachable, file and printer sharing may need to be enabled, and your account needs the right permissions. Home networks often block this by default.
Frequently Asked Questions
What is the command to shut down Windows immediately?
Use shutdown /s /t 0. The /s switch selects shutdown and /t 0 sets zero delay.
How do I cancel a shutdown I scheduled?
Run shutdown /a before the countdown ends. It does not work after Windows has started closing.
Does the shutdown command save my open files?
No. It closes Windows without prompting. Save your work first, and avoid /f unless you are prepared to lose unsaved changes.
Can I use this command on Windows 11?
Yes. The shutdown command is included in Windows 11 and works the same way as in Windows 10 for the switches described here.
Why does my PC wait 30 seconds before shutting down?
That is the default delay when you do not include /t. Add /t 0 for an immediate shutdown, or use shutdown /a to cancel during the wait.
Can I shut down another computer on my network with this command?
Only if the remote PC allows it and your account has permission. Use shutdown /s /m \\COMPUTERNAME /t 0, and expect it to be blocked on many home networks by default.