Windows OS

How to Shut Down or Restart Windows System Using PowerShell or Command Prompt

Apart from the traditional methods of shutting down and restarting Microsoft Windows, a few other methods exist. Two of them include: “PowerShell” and “Command Prompt”— command-line interfaces available in Windows.

This guide explains the methods to “Shutdown” or “Restart” the system using “PowerShell” or “Command Prompt” by covering the following content:

How to “Shut Down” or “Restart” the System Using “PowerShell”?

“PowerShell” is a command-line shell, configuration management framework, and scripting language developed by Microsoft. It offers advanced capabilities for system administration, configuration, and automation. To “Shut down” or “Restart” your system, follow these steps:

Step 1: Launch “PowerShell”

To open PowerShell, press the “Windows” key, enter “Windows PowerShell,” and trigger “Run as Administrator”:

Step 2: Shut Down the System

To shut down your system, use the following command and it will trigger the immediate “Shut down”:

Stop-Computer

In situations where you need to “Shut down” the system after a specific time, you can use the “Start-Sleep” command like this, and here the “60” stands for the time (in seconds) after which the system will shut down:

Start-Sleep -Seconds 60; Stop-Computer

If the above commands do not work, there may be a probability that one of the programs/services is not responding which is causing the delay in the “Shut down”. To force a “Shut down”, you can use an additional “-Force” flag like this:

Stop-Computer -Force

Step 3: Restart the System

To restart your system, use the below-stated command:

Restart-Computer

Likewise, to trigger a force “Restart”, use the “-Force” flag, as follows:

Restart-Computer -Force

To “Restart” the system after a specified time, let’s say 30 seconds, we’d use the following command:

Start-Sleep -Seconds 30; Restart-Computer

How to Shut Down or Restart the System Using “Command Prompt”?

“Command Prompt”, “CMD”, or “Command Line Interpreter” is a traditional command-line interface that has been a part of Windows for so many years. To shut down or restart your system via this approach, follow these steps:

Step 1: Launch “Command Prompt”

To open Command Prompt, press the “Windows” key, enter “CMD” and trigger “Run as administrator”:

Step 2: Shutdown the System

To shut down your system using the “Command Prompt”, use the following command:

shutdown /s

After the above command is executed, you will see the following message saying that the system is going to “Shut down”:

If there is an app/service that is preventing the “Shut down”, use the “/f” flag to forcefully shut down the system:

shutdown /s /f

Once executed, the system will forcefully shutdown after a few seconds:

The “Command Prompt” also enables the users to do a scheduled “Shut down”. Suppose you want to shut down your system after “10 minutes”, use the following command where “/t” stands for time and “600” is the seconds after which it will shut down:

shutdown /s /t 600

If you want to cancel the scheduled “Shut down” instead, use the below-provided command that includes the “/a” flag to cancel the scheduled shutdown:

shutdown /a

Step 3: Restart the System

To restart the system, you can use the same commands as discussed but replace “/s” with “/r”. Let’s begin with triggering a simple “Restart”:

shutdown /r

Similarly, you can force a system “Restart” using the “/f” flag:

shutdown /r /f

For a scheduled “Restart”, use the following command where “/t” represents the time (in seconds) after which the system restarts which is “300 seconds” in this case:

shutdown /r /t 300

To cancel a scheduled “Restart”, use the “/a” flag like this:

shutdown /a

Conclusion

To shut down a system using “PowerShell”, the cmdlet “Stop-Computer” is used and for the restart, the “Restart-Computer” command is utilized. In the “Command Prompt”, the command “shutdown /s” is used to shut down the system and for restart, the command “shutdown /r” is utilized. These commands can further be applied with the flags or options based on requirements. This guide explained the methods to “Shut down” or “Restart” a Windows system using “PowerShell” or “Command Prompt”.

About the author

Ali Usman

Ali's insatiable curiosity drives him to continuously explore emerging trends, cutting-edge innovations, and gaming developments. This thirst for knowledge allows him to provide timely and relevant insights to his readers.