Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Reboot Windows 11 from Command Line: CMD & PowerShell

· 5 min read · Home Tech

In this article
  1. Why Use the Command Line to Reboot?
  2. The Core Command: shutdown
  3. PowerShell: Restart-Computer
  4. Choosing Between CMD and PowerShell
  5. Common Problems and Solutions
  6. Safety and Data Loss
  7. Alternatives to the Command Line
  8. Frequently Asked Questions

Yes, you can reboot Windows 11 from the command line using the shutdown command, and the most direct form is shutdown /r /t 0 (in Command Prompt) or Restart-Computer (in PowerShell). This article explains both methods, their options, and how to handle common issues like forced restarts or remote reboots.

Why Use the Command Line to Reboot?

Most people click the Start menu and choose Power > Restart. But the command line is faster for repetitive tasks, essential for scripting and automation, and sometimes the only option when the graphical interface is unresponsive (e.g., a frozen shell). System administrators use it to reboot multiple machines remotely, and power users may prefer it for its precision—you can set a delay, force-close apps, or add a comment to the event log.

It also works in environments where you only have a terminal, like Windows Server Core or a recovery console. Learning the command takes under a minute and can save you from several clicks every day.

The Core Command: shutdown

The shutdown.exe utility has been part of Windows for decades. Its syntax is simple:

shutdown /r /t 0
  • /r – restart (as opposed to /s for shutdown, /l for logoff, /h for hibernate).
  • /t 0 – time delay in seconds before the restart. 0 means immediately. You can use any number, e.g., /t 60 for one minute.
  • /f – force-close running applications without warning (add this if you want to skip the “you have unsaved work” prompt).
  • /c "comment" – adds a comment to the system event log (useful for tracking).
  • /a – abort a pending shutdown (only works if you haven’t rebooted yet).

For example, to restart after 30 seconds with a forced close and a note, you would run:

shutdown /r /t 30 /f /c "Scheduled maintenance"

If you need to cancel a scheduled restart (say you accidentally set it), use shutdown /a in the same window or any other command prompt.

PowerShell: Restart-Computer

PowerShell is the more modern shell, and it offers a dedicated cmdlet: Restart-Computer. It’s more readable and integrates with other PowerShell features.

Restart-Computer

That restarts immediately. You can add parameters:

  • -Force – forces restart even if apps are hanging.
  • -Delay 60 – waits 60 seconds before restarting.
  • -ComputerName "PC2" – restarts a remote computer (requires permissions).
  • -Credential – supplies alternate credentials for remote reboots.

Example with a delay and force:

Restart-Computer -Force -Delay 30

Unlike shutdown, Restart-Computer does not have a built-in “abort” command. To cancel a pending restart in PowerShell, you’d have to use shutdown /a anyway.

Choosing Between CMD and PowerShell

If you’re writing a batch script (.bat or .cmd), use shutdown because it’s available in every Windows environment and has a simpler syntax for delays. If you’re working in PowerShell, Restart-Computer is more natural, especially if you need to handle multiple computers or integrate with other cmdlets.

For most single-machine restarts, either works. The shutdown command is also the one you’ll find in older documentation and in the Run dialog (Win+R, then type shutdown /r /t 0).

Common Problems and Solutions

Here are issues you might run into, and how to fix them:

  • “Access denied” – You need administrator privileges for some options, especially /f or remote reboots. Right-click Command Prompt and select “Run as administrator”.
  • “The system cannot find the file specified” – This usually means you mistyped the command or used a slash instead of a dash. Check your syntax.
  • Restart takes too long – Windows tries to close applications gracefully. Add /f (or -Force) to skip that, but be aware you might lose unsaved work.
  • Remote restart fails – Ensure both computers are on the same network, have the Windows Firewall rule for “Remote Shutdown” enabled, and you have admin rights on the target.
  • Shutdown is aborted by another program – Some apps (like a pending Windows Update) can block a restart. Use shutdown /r /t 0 /f to override, but again, save your work.

Safety and Data Loss

The most important thing to know: shutdown /r /t 0 will close all your open programs immediately if you add /f. Without /f, Windows will prompt you to save unsaved work, but if the prompt is ignored, the restart proceeds anyway. Always save your files before running a forced restart.

Also, be careful with /t 0 – there is no undo after the countdown reaches zero. If you set a delay, you can cancel with shutdown /a before it expires.

For remote reboots, you might lock yourself out if the machine doesn’t come back up correctly. Only reboot remote servers during maintenance windows.

Alternatives to the Command Line

If you’re not comfortable with typing commands, Windows 11 offers other ways:

  • Start menu – Click the Start button, then Power > Restart.
  • Ctrl+Alt+Del – Press these keys, then click the power icon and choose Restart.
  • Alt+F4 – On the desktop, press Alt+F4, select “Restart” from the dropdown, and click OK.
  • Run dialog – Win+R, type shutdown /r /t 0, and press Enter.

All of these do the same thing under the hood. The command line is just the most scriptable and remote-friendly option.

Frequently Asked Questions

How do I restart Windows 11 from Command Prompt?
Open Command Prompt (as administrator if needed) and type shutdown /r /t 0 then press Enter. The computer will restart immediately.

Can I cancel a restart after I’ve entered the command?
Yes, if you set a delay (e.g., /t 60), you can type shutdown /a in the same or another command prompt before the time runs out. This aborts the pending restart.

What is the difference between shutdown /r and shutdown /s?
/r restarts the computer (turns it off and on again), while /s shuts it down completely, leaving it off until you press the power button.

Why does my computer restart instead of shutting down when I use shutdown /s?
This can happen if Windows Update has a pending restart or if your hardware has a “fast startup” setting that makes shutdown behave like a hybrid. Check Power Options and disable fast startup if you want a full shutdown.

How do I restart a remote computer from the command line?
Use shutdown /r /m \\computername /t 0 (CMD) or Restart-Computer -ComputerName "computername" (PowerShell). You need admin rights on the remote machine and the firewall must allow remote shutdown.

Is there a way to restart Windows 11 using a keyboard shortcut?
Yes, press Ctrl+Alt+Del, then click the power icon in the bottom right and select Restart. Or, on the desktop, press Alt+F4 and choose Restart from the dropdown.