Reboot your computer via command line immediately
Before you start restarting your computer through the command line, you need to understand exactly how to launch the command line. For this:
- Click on "Search" and enter "Command Prompt"
- To restart your computer from the command line, enter the command: shutdown /r. Then press Enter.
In this case, we send the shutdown command to the system, that is, to force the computer to shut down. The “/” symbol specifies the parameter for this command. In our case, /r, which means “restart”.
But the reboot will not begin immediately, but only after 60 seconds. The user can specify any time using the additional parameter “/t”. That is, in this case, the command to restart the computer after a specified time will look like this: shutdown /r /t 30, where instead of 30 you can enter the required number of seconds.
If you specify shutdown /r /t 0, this will cause the system to immediately reboot the computer, regardless of whether the user is running any programs.
Reboot with different keys
To perform this procedure, you need Administrator rights.
First of all, you need to launch Command Prompt. You can read about how to do this on our website.
The “Shutdown” command is responsible for restarting and shutting down the PC. Below we will look at several options for restarting your computer using different keys.
Method 1: Simple Reboot
For a simple reboot, enter in cmd:
A warning message will appear on the screen and the system will restart after 30 seconds.
Method 2: Delayed reboot
If you want to restart the computer not immediately, but after a while, in “Cmd” enter:
shutdown -r -t 900
where 900 is the time in seconds before the computer restarts.
A message indicating a scheduled shutdown will appear in the system tray (lower right corner).
You can add your comment so you don't forget the purpose of the restart.
To do this, add the “-c” switch and write a comment in quotes. In Cmd it will look like this:
And in the system tray you will see the following message:
Method 3: Reboot the remote computer
You can also reboot the remote computer. To do this, you need to add its name or IP address separated by a space after the “-m” key:
shutdown -r -t 900 -m \Asmus
shutdown -r -t 900 -m \192.168.1.101
Sometimes, if you have Administrator rights, you may see the “Access denied (5)” error.
- To fix it, you need to remove the computer from the Home Network and edit the registry.
In the registry, go to the folder
Right-click on the free space, in the context menu go to the “New” and “DWORD Value (32-bit)” tabs.
Name the new parameter “LocalAccountTokenFilterPolicy” and give it the value “00000001”.
- For the changes to take effect, restart your computer.
Cancel reboot
If suddenly you decide to cancel the system restart, in the “Command Line” you need to enter
This will cancel the reboot and the following message will appear in the tray:
This is how you can easily restart your computer from the Command Prompt. We hope this knowledge will be useful to you in the future.
Restarting the computer via the command line with a message to users
System administrators often have to remotely manage computers located in the office. And they can turn them off remotely too. And to warn users about the upcoming shutdown who are currently working on the computer, you can use a special command for the command line: shutdown /r /c “Everything will go out now! Save yourself!
In this case, a corresponding notification will appear on the screen of the remote computer, and then the counter will begin counting down 60 seconds. This time is provided to the user so that he can save all necessary documents and complete work in running applications.
If you specify the additional parameter “/t 0”, this will cause the computer to reboot immediately. But you need to take into account that it is impossible to cancel execution.
If an immediate reboot of Windows is launched from the command line, the system kernel is immediately blocked, that is, the computer will no longer accept any commands until the process is completed.
Volga or Pobeda? Are you familiar with the Soviet automobile industry? Test yourself in a fun test!
Shutdown command: Shut down and restart Windows from the command line
shutdown command line utility is a built-in Windows command that allows you to restart, shut down, hibernate, or log off your computer. In this manual, we will show basic examples of using the shutdown command in Windows (all discussed commands are launched in the Run window - Win + R ->, in the cmd.exe command line or in the PowerShell console).
The shutdown command has the following syntax:
shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f] [/m \\computer][/t xxx][/d ]
As you can see, the command has quite a few options and also has the ability to perform shutdown/reboot operations on a remote computer.
Shutdown Windows using the Shutdown command
To shut down the Windows OS and computer, you must use the shutdown command with the /s .
shutdown /s
Reboot Windows
To restart your computer, you must add the /r . After running this command, Windows will reboot correctly.
shutdown /r
Ending a user session
To end the current user session (logout), you need to run the command:
shutdown /l
This command is similar to running the logoff .
Putting your computer into hibernation mode
To put the computer into hibernation mode (in this mode, all memory contents are written to the hyberfil.sys on disk and the computer goes into sleep mode with reduced power consumption), run the command:
shutdown /h
Restarting the computer with a message to users
You can warn all Windows users about the upcoming shutdown/reboot of the computer or server by sending a message to all active sessions (usually this feature is used on RDS terminal servers, on which several users work simultaneously, each in their own RDP session).
shutdown /r /c “This server will reboot in 60 seconds.”
Delayed shutdown/reboot of the computer
You can turn off or restart your computer with a certain delay (by a timer). Using the /t , you can specify the time interval (in seconds) after which the PC/server will be rebooted or shut down. This way, you can give users extra time to save open files and close applications gracefully. This option is convenient to use in conjunction with sending a message. In this example, we specify that Windows will shut down in 10 minutes (600 seconds) and inform users with a message.
shutdown /s /t 600 /c “The server will be shut down in 10 minutes. Save your documents!
The user will receive a warning about the scheduled shutdown: Your session will be terminated.
If the delay is very long, for example 100 minutes (6000 seconds), then instead of a warning window, a pop-up message appears in the lower right corner of the screen: “Your session will be terminated. Windows will shut down in 100 minutes."
Cancel shutdown/restart of computer
After running the shutdown command or restarting Windows, by default the shutdown utility waits 60 seconds without performing any action. The administrator can cancel the reboot or shutdown of the device if during this time he manages to execute the command:
shutdown/a
After canceling the shutdown, a pop-up message will appear in the lower right corner of the screen: “Logout cancelled. Scheduled shutdown cancelled."
Restart your computer immediately
To shut down or restart the computer immediately, without waiting the standard 60 seconds, you must specify a value of 0 for the /t parameter. For example, to immediately restart the computer:
shutdown /r /t 0
/f switch is very important . I use it almost always when shutting down or rebooting Windows servers. This attribute ensures the forced termination of all running programs and processes without waiting for confirmation from the user (we won’t wait for confirmation of closing programs from all users on the terminal server, we simply won’t wait for it).
The following command will restart the computer and automatically launch all registered applications after reboot (meaning applications registered with the system using the RegisterApplicationRestart API function).
shutdown /g
Running the shutdown command on remote computers
You can reboot a remote computer over the network; to do this, you must have network access to it, and the account under which the shutdown command is run must be a member of the local administrators group on the remote computer (server):
shutdown /r /t 120 /m \\192.168.1.100
If all the specified conditions are met, but when you run the shutdown command, the error “Access Denied (5)” appears, you need to allow remote access to administrative resources (C$, ADMIN$) on the remote computer by changing the value of the LocalAccountTokenFilterPolicy parameter to 1.
reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "LocalAccountTokenFilterPolicy" /t REG_DWORD /d 1 /f
If you need to remotely reboot many computers, you can save a list of them to a text file and start a remote reboot of all computers using the following PowerShell script:
$sh_msg = “Your computer will automatically restart in 10 minutes. Save your files and close running programs" $sh_delay = 600 # seconds $computers = gc C:\PS\PC-list.txt foreach ($comp in $computers) { & 'C:\Windows\System32\SHUTDOWN.exe' "-m \\$comp -r -c $sh_msg -t $sh_delay" }
shutdown command graphical interface
For those who are not comfortable working on the command line, there is a graphical interface for the shutdown command, to call it, type:
shutdown /i
As you can see, in the remote shutdown dialog you can add several computers that need to be restarted/shut down, specify the notification text and set the shutdown reason to be saved in the Windows log.
Shortcut to restart your computer
For the convenience of users, you can create shortcuts on the desktop to shut down or restart the computer with the necessary settings. Such a shortcut can be useful for rebooting from an RDP session when there are no reboot/shutdown buttons in the Start menu.
If you want your computer or server to always shutdown/reboot at a certain time, you can add the shutdown command with certain parameters to the Windows task scheduler taskschd.msc.
For example, the following scheduler task will reboot the computer every night at 0:00.
Or you can create a new scheduler job from PowerShell:
$Trigger= New-ScheduledTaskTrigger -At 00:00am -Daily $User= “NT AUTHORITY\SYSTEM” $Action= New-ScheduledTaskAction -Execute “shutdown.exe” -Argument “–f –r –t 120” Register-ScheduledTask - TaskName "RebootEvertyNight_PS" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force
Shortcut to restart your computer
To execute a command faster, you can create a shortcut on the desktop, which, when clicked, automatically executes the programmed command. To do this you need:
- Right-click on a free area of the desktop, select “Create”, specify “Shortcut”.
- A window will appear where you can specify which command will be executed when pressed. You must specify shutdown -s -t 0, click “Next”.
- Specify where to save the shortcut
Next, just double-click on the created shortcut, and the computer will immediately begin to reboot. It should be noted that in this case, command execution parameters are indicated not through the “/” symbol, but through “-”.
Super test on the topic “Money” and how can you be friends with it?
Cancel shutdown restart computer
Let's say that the system administrator wanted to restart the computer because one of the Windows services was not working correctly. He first entered the command shutdown /r /t 300 through the command line, but later figured out what the problem was with the OS. How then can I cancel the shutdown reboot? To do this, use the shutdown /a command.
Ignore warnings when closing applications
When the user turns off the PC using the appropriate button from the Start menu, a warning may appear indicating that some programs are currently performing some action. And so that the OS does not accidentally close them, a corresponding notification appears. Shutdown is temporarily suspended until the program that "prevents" the system from executing a given command completes.
Using the command line, you can force a PC restart, and at the same time close all running programs without warning the user. This option is useful in cases where one of the applications is frozen and not responding.
In this case, you need to enter into the command line window: shutdown /r /f and press Enter.
Under no circumstances should you restart your computer through the command line while installing Windows updates. This can lead to damage to system files, and in the future the system will simply stop booting normally. You'll have to use "Recovery". But if the bootloader is damaged, you will have to completely reinstall Windows and format the hard drive.
What instrument are you? Take the test and find out
Reboot command, detailed instructions for use
Sometimes you don’t want to do a lot of actions in order to turn off or restart your computer. This process is especially long in Windows 8/8.1. But, fortunately, using the command line you can speed up this process significantly. In this article we will tell you how to do this.
How to shut down your computer using the command line
First, you need to open the command line. There are two ways to do this: 1. Press the Win+R key combination. If you don't know what the Windows key is, read our article on how to find it. 2. Right-click on the Start menu and select Run.
The author believes that these materials may help you:
- Computer shutdown timer - the easiest way
- How to disable the touchpad - detailed instructions, all methods and options
- If the computer does not turn off, what should I do?
- How to assemble a computer, instructions for beginners
One command is responsible for shutting down and rebooting - “shutdown”, the only difference is in the parameters used.
To simply turn off the computer, just write “shutdown -s” without quotes in the “Run” window and click OK. The computer will shut down after 1 minute, giving you time to close all files and applications.
To speed up shutdown, the command will be a little more complicated - “shutdown -s -t 0”, where: -s – shutdown parameter; -t 0 – delay time in seconds, in our case equal to zero.
But, if you have any documents open that require saving before shutting down the computer, Windows will stop the shutdown and wait for you to save the files or confirm that nothing needs to be saved. To avoid this, use the command “shutdown -s -t 1 –f”, where “-f” is the forced shutdown option, refusing to save changes. The time in this case is set to 1 second, only because the “-f” parameter requires specifying a non-zero time.
How to restart your computer using the command line
Everything is just as simple. Only the “-r” parameter is used, that is, the simplest reboot command will look like this: “shutdown -r”.
To speed up the reboot, specify a zero time - “shutdown -r -t 0”. Well, if we want to forcefully close open documents without saving - “shutdown -r -t 1 -f”.
How else to speed up shutdown/reboot
You can create an executable BAT file with the necessary commands and place it, for example, on your desktop. You can use 2 ready-made files, for restarting the computer, and for shutting down. Please note that the files must be run as administrator; how to do this is described in detail in our instructions.
If you have any questions, ask, we will help you promptly!
Putting your computer into hibernation mode
You already know how to restart your computer via the command line, but you can not only restart your computer, but also “send” it to hibernation mode. First you just need to make sure that the function is enabled in the settings of Windows itself. To do this you need:
- Go to the “Control Panel” by holding down two keys Win + r and enter the command “control”
- In the "Control Panel" select "Power Options".
- Click on the line “Actions of the power buttons”.
- Next “Change settings”
- Put o.
And you also need to make sure that there is enough space on drive C (where the system is installed) to save the hibernation file. It takes up as much RAM as is installed in the PC. That is, if the computer has 16 gigabytes of RAM, then to enable hibernation mode there must be at least 16 gigabytes of free space on the system disk.
Otherwise, the function will be automatically disabled.
And to put the computer into hibernation mode from the command line, use the command: shutdown /h
Can you tell a cringe from a crash? Take this fun test and find out!
Ending a user session
If the user wants to end the session and log in to the system under another account (guest, administrator), then for this you can use 2 equivalent commands: logoff or shutdown /l
There is no difference between them. Each of these commands performs the same action.
And, as reboot works in the command line, the session will also not be terminated instantly, but with a warning and a countdown of 60 seconds. Using the command option "/t 0" this can be done immediately.
Running the shutdown command on remote computers
If computers are connected to a single local network, and one of them is configured as a server with an administrator account, then all other computers can be managed through it. Accordingly, this provides the ability to turn it off or restart it remotely.
To do this, use a command like shutdown /t 120 /m \\192.168.1.155 (reboot). Instead of 192.168.1.155, you must specify the local IP address of the device to which the command is sent.
shutdown command graphical interface
Not all users are comfortable working through the command line. But you can remotely control computers on a local network (turn them off, reboot them, end sessions) through the graphical interface. All you need to do is use the command shutdown /i
After this, the “Remote Shutdown Dialog” window will appear. The user only needs to select the local IP address of the remote computer, set the command parameters, and click “OK”. You can also specify the warning text there.
Please note that shutting down or rebooting a remote computer at the command line will only work properly if the PC is configured as a server with administrator rights.
Examples of using the shutdown utility
If you run the shutdown with the /i parameter, you will see something like the following on the screen (relevant for Windows 7):
When using delayed reboot:
We will receive the following notification on the screen:
If you want to cancel the scheduled reboot, use the command:
You should see something like this in the notification area next to the clock: