IT administrators often perform remote system reboots of computers when required. Power users are often also required to reboot a computer while performing tasks on the Command Line Interface (CLI) in a Windows environment, and doing so through the Start Menu is not the most optimized way to do it.
We are here to inform you of multiple ways with various parameters that you can use to reboot your devices using the command line, for both local computers as well as remote ones.
- 1 Shutdown cmdlet & switches
- 2 Restart your local computer using Command Line
- 3 Restart remote computer using Command Line
- 4 Closing words
- 5 Continue Reading:
Shutdown cmdlet & switches
The command used to reboot computers is “shutdown.” A number of different switches can be concatenated with this cmdlet to perform various functions. Here is a list of the switches and their uses:
- /s – Shutdown the computer
- /r – Restart computer
- /m – Specify the remote computer name
- /t – Set the time delay in seconds
- /c – Custom message to display
Restart your local computer using Command Line
We are going to start with how you can reboot a local Windows computer using the Command prompt, and then use the same login to reboot remote computers on the same network.
Restart your computer
To simply reboot a computer, enter the following command:
You will then be prompted with a message such as the following, and the system will immediately reboot.
Restart computer after time delay
You can also set a time delay before the computer reboots, using the command below. Replace TimeInSeconds with the number of seconds you want to delay it:
shutdown /r /t TimeInSeconds
The maximum time you can put it in is 60 seconds. In response to this command, you will see a message like the one below, depending upon the time delay you put in the command:
Cancel a computer restart
If you decide to cancel a system reboot that is going to occur after some time delay, you can use the command below to cancel it:
Entering this command will result in a notification in the tray informing you that the action has been canceled.
Forcefully restart your computer
You can also add an additional switch to forcefully reboot the computer. This prevents any open applications or unsaved data to stop the reboot and restarting the computer whatsoever.
shutdown /r /f
Add custom message while restarting computer
You can also add a custom message to be displayed when the device is going to be rebooted. This is especially useful for IT administrators while rebooting remote computers. Use the command below to do so:
shutdown /r /c "Put custom message here"
As you may find in the image above, the message that we put in the cmdlet has been displayed in the dialog box. Also, you can use the /c switch in any cmdlet used to add a custom message. Here is an example with a time delay switch /t.
You can also use the /s switch instead of the /r switch in all of the commands above to completely shut down the computer altogether. It can be used as a standalone switch, or with the /t switch to shut it down with a time delay. Here is an example:
Restart remote computer using Command Line
Now that you know the cmdlets to reboot a local computer, rebooting a remote computer will be easy. All that is required now is to use the same cmdlets together with a few additional switches to access the remote computer and reboot it.
The switch used together with the shutdown command to specify another computer is /m.
Restart remote computer
To restart a remote computer, use the following command while replacing RemotePCName with the name of the target device.
shutdown /r /m \\RemotePCName
Ensure that the remote computer is on the same network as yours for the command to work.
Now that you know the concept, you can use any of the commands discussed in this article for a remote computer. Here is a command to reboot a remote computer after a delay of 60 seconds with a custom message:
shutdown /r /m \\RemotePCName /t 60 /c "Your computer is being restarted by your IT Admin"
Although there are multiple ways in the GUI of Windows to reboot a computer, it does not however give the various options the command line does, such as introducing a delayed reboot.
Unlike regular Windows users, the command line is a more comfortable environment for IT professionals and administrators. Therefore, performing even the little tasks, like rebooting a PC, from the command line can be helpful to them.