How to Shut Down or Restart Windows 11 from the Command Line
Shutting down or restarting Windows 11 from the command line is useful in scripts, for scheduling, or when you prefer typing to clicking. Windows 11’s `shutdown` command controls power actions with various YYGACOR Login timing and behavior options.
The Command
shutdown /r /t 0
What It Does
This restarts the computer immediately. `/r` specifies a restart (as opposed to a full shutdown), and `/t 0` sets the delay to zero seconds, so it happens right away. This gives you direct control over restarting from the command line, which is handy in scripts or when finishing a task that requires a reboot.
When You’d Use This
This is useful in scripts that must reboot or shut down as part of a process, for scheduling a delayed shutdown, or simply when you prefer the command line. The delay option gives you time to save work, the abort option cancels a pending shutdown, and the recovery option restarts into advanced troubleshooting tools, making it a flexible way to control power actions.
Useful Variations
To shut down instead of restart, use `/s` in place of `/r`. To add a delay, change the `/t` value to a number of seconds. To cancel a pending shutdown, `shutdown /a` aborts it. Adding `/f` forces running applications to close, and `shutdown /r /o` restarts into the advanced recovery options.
If It Doesn’t Work
If you started a shutdown by mistake, `shutdown /a` aborts it during the delay window, so setting a delay with `/t` gives you that safety margin. The `/f` flag forces programs to close without saving, so use it deliberately to avoid losing work. If the command is denied, some power actions or the recovery restart may require an administrator terminal to execute.
Good to Know
Using a delay with `/t` gives you time to save work before the action occurs, and `shutdown /a` cancels a scheduled shutdown during that window. The `/f` flag forces programs to close without saving, so use it deliberately. Restarting into recovery options with `/o` is useful when you need advanced startup and troubleshooting tools.
Putting It Together
Once you have run it once or twice, this becomes second nature. As part of keeping Windows healthy and automating upkeep, this command is part of the maintenance routine that resolves problems and prevents them. Combined with the related service and repair commands, it gives you direct control over the background machinery that keeps the system running well. Like anything in the terminal, the real value comes from trying it on your own system and adapting the variations above to what you actually need, so it is worth experimenting with in a safe, low-stakes situation before relying on it in a script or during troubleshooting. Keeping a note of the commands you find most useful, along with the variations that fit your workflow, turns scattered one-off tricks into a personal reference you can draw on whenever a similar task comes up again.