How to Shut Down and Restart the PC From The Command Prompt 2021 – Turning off the computer is one of the tasks that most users perform on a daily basis when they finish work. Something really routine and simple, since you just have to click on the Windows Start button and click on the shutdown option or use the keyboard shortcut Alt + F4, for example.
How to shut down and restart the PC from the command prompt 2021
However, things can get complicated when for some strange reason the Start button does not work or the graphical interface of the system has been blocked, for example. In this circumstance or whenever we want, it is important to know that we can turn off the computer from the command prompt or CMD.
Normally we can restart the computer easily by tapping on the Windows icon and tapping on the Start window and tapping on “Start / Shutdown” to be able to turn off the computer easily. But there are other means to do it, like shutting down the computer from CMD. From the command prompt, we can do all kinds of things … From checking the quality of the WiFi network or the final power that reaches us to turning off the computer or creating symbolic links for backups.
What is the command prompt or CMD?
The command prompt or also known as CMD for being the abbreviation of CoMmanD is a command interpreter based on Windows and that is the equivalent of the famous command.com in MS-DOS. In short, an application that allows us to perform or execute certain functions of the graphical interface but through commands that are sent to the cmd to execute them. In this way, we can execute certain functions that are also available from the graphical interface without using it and even others that are only available from the command line.
To use the command prompt, we must launch the application and once there, enter a valid command, along with any of its optionally accepted parameters. With the simple act of pressing Enter, the command will be sent and executed, as long as the syntax is correct.
How to access CMD or command prompt
We have two options to access CMD and the first one is the simplest:
- Press the Microsoft / Windows key + the R key on the keyboard at the same time
- A window will open on the computer, the advantage of Run
- Inside the box, you can write what you want
- Type cmd
- Hit enter or tap “OK”
Cmd.exe will automatically open and you can write whatever you want in it.
But if you cannot open in Windows + R or you cannot open “Run” there are other steps we can do to open CMD from the computer folder:
- Open your equipment on the computer
- Go to the Local Disk (C 🙂 folder
- Go to the “Windows” folder
- Within Windows, tap on “System32”
- In System32, search for “cmd”
- Tap on it and you will enter the console or command prompt
Restart or shut down the computer from CMD
To restart or shut down the computer from the command line, we will have to use the shutdown.exe command. It is one of the CMD commands and the one that allows us to indicate if we want to restart or turn off the computer. The first thing we have to do is use the previous steps to open the command prompt or CMD on our computer. Then we will run shutdown.exe
To do this, the first thing we must do is know the syntax of it, of this command that is full of letters and that, will be the one we use to shut down or restart. There are several different extensions and we are going to explain them to you below so that you know which one you should use in each case:
shutdown [/ i | / l | / s | / r | / a | / p | / h | / e] [/ f] [/ m <ComputerName>] [/ t <XXX>] [/ d [p | u:] <XX>: <YY> [/ c “comment”]]
/ i with this extension will display a graphical version of the system shutdown, restart and suspend functions.
/ l, in this case, will close the session immediately, regardless of the user who is using it.
/ s will be used to shut down a computer by typing its name.
/ r is the way to shut down and restart your computer remotely.
/ g the same as / r, but the reboot will be deeper.
/with this extension, we will stop a scheduled shutdown.
/ p is used to shut down the computer permanently.
/ h thanks to this command the system will go into hibernation mode.
/ eWe enable documentation in the Shutdown Event Tracker, in case the system shuts down suddenly.
/ or we will end the session and the Advanced boot options menu will open.
/ hybrid causes the computer to do a quick reboot.
/ f if we use this extension all active programs will be closed automatically.
/ m is a command that is used with ” name ” that will shut down a specific computer remotely.
/ t just in the seconds that we put after the “t” the computer will be paid.
As we can see, it allows a lot of parameters to establish certain configurations or even to shut down the computer remotely, among many others. However, the most important parameters to order the computer to restart or shut down permanently are / s and / r.
Turn off the PC
Specifically, the / s parameter is the one that indicates that what we want to do is turn off the computer, as we can see in the previous list. This will be the one we need. So, just type the command:
shutdown / s
and press Enter on the command line so that we can see how our computer shuts down automatically. Keep in mind that everything must be written as it says in the previous paragraph and, if not, the command may not work and you will have to retype it.
Now, within the syntax of the command itself, there are other parameters that can accompany the instruction to shut down the computer. For example, [/ t <XXX>], which allows us to configure the shutdown of the equipment after a certain time that we will establish in seconds. Not only do you turn it off but you “configure” the shutdown, for example. That is, if what we want is to shut down the system after two minutes since we launched the command, we must write the following at the command prompt:
shutdown / s / t 120
As in the previous case, you can write it and you will automatically press enter. You must write the time in seconds. That is, of course, in multiples of 60. If you want it to turn off in two minutes it will be 120 (as you can see in the screenshot below) and if you want it to turn off in three it will be 180, etc. As soon as we execute it, we will be shown a window in which the system itself will inform us that the computer is going to shut down within 2 minutes. If at any time the need arises to cancel this order and we do not want the computer to shut down, we can cancel the process by executing the shutdown / a command.
Restart your computer
On this occasion, the parameter that we must use to request a restart of the computer after it has shut down is / r. Therefore, if what we want is to order a restart of the PC from the command line or CMD, this is the command we must execute:
shutdown / r
As we indicated when turning off the computer, it is also possible to indicate that the system waits a certain time before proceeding with the restart. To do this, we can use the same / t XXX parameter as follows:
shutdown / r / t 120
This will cause the computer to restart after shutting down after waiting two minutes from the moment we execute the command. We can also cancel this order by launching the shutdown / a command before the established time-out expires.
Quickly shut down or restart the PC
These same commands that we have just mentioned to be able to shut down or restart the computer from the command line can be used to create a shortcut on the desktop and thus be able to execute them with a simple click without having to enter the CMD. To do this, the first thing we have to do is click with the right mouse button on a free space on our desktop and select the New> Shortcut option.
That is, the steps to follow will be the following:
- Click the right mouse button
- A drop-down menu will open
- Choose the option «New»
- Hover over this option
- Choose «Shortcut»
Next, a window will open in which we must indicate the location of the element. That is where we will have to write the command we want to execute, shutdown.exe -s, shutdown.exe -r, or any of the variations or with the parameters mentioned above.
Click on Next, we give our shortcut a name, and finally, click on Finish. Now we can see how a new shortcut appears on our desktop that we can click to restart or turn off the PC. We have a file with direct access to this shutdown.exe panel, so all you have to do is touch it or run it from the desktop to restart or shut down the computer remotely depending on the direct access we have created. It will depend on the formula or the location that you have added in the previous screen that you manage to restart at the moment, after a while, turn off
Thank you for reading the article.
Don’t forget to bookmark and always visit our website techrizwa.com because you will find the latest Technology, Android, games, Apps ETC, that we will update every day.