+4 votes
703 views
in Setting by (242k points)
reopened
Run shutdown in CMD on Windows

1 Answer

+5 votes
by (1.6m points)
edited
 
Best answer

Shutting down Windows with commands: explanation and advantages
Step One: Open Command Prompt to Enter Shutdown Commands
Shutdown with CMD: how to use the command line
The most important CMD shutdown commands
Other options for shutting down the computer
Open the search box with the mouse and type cmd
Open? Run? with a keyboard shortcut and type cmd
Example: shut down the local computer after 20 seconds
Example: shutting down a remote computer after one minute

image

Run shutdown in CMD on Windows

Everyone knows how to shut down a computer using the Windows user interface. However, it only offers limited options . Perhaps many are unaware that it is possible to configure the shutdown of the computer in many ways by entering special commands at the command prompt, the operating system console, which allows the user to interact with Windows..

Index
  1. Shutting down Windows with commands: explanation and advantages
  2. Step One: Open Command Prompt to Enter Shutdown Commands
    1. Open the search box with the mouse and type cmd
    2. Open? Run? with a keyboard shortcut and type cmd
  3. Shutdown with CMD: how to use the command line
  4. The most important CMD shutdown commands
    1. Example: shut down the local computer after 20 seconds
    2. Example: shutting down a remote computer after one minute
  5. Other options for shutting down the computer

Shutting down Windows with commands: explanation and advantages

The Windows command line or command prompt is a very powerful tool developed in the old days of MS-DOS, which still supports countless commands with different functions today. In fact, its name refers to an executable program, cmd.exe , which opens an interface where commands are entered (the command prompt itself). To shut down the computer, this tool uses the shutdown.exe program , which, for example, shuts down the computer immediately, restarts it, or logs off the current user.

The advantages of controlling your computer using commands are obvious: using them to shut down Windows saves mouse clicks and avoids having to navigate through the different menus in the Windows user interface . If you issue a shutdown command , the computer shuts down quickly and directly..

Other benefits are flexibility and adaptability - you can choose from a variety of shutdown types and configure them to create many variants. To customize the shutdown mode, control parameters are added . Each mode is intended for a specific use. Due to their adaptability, shutdown commands play an important role, for example in the administrative field. In this way, it is possible to control remote computers and servers. The scripts specials shutdown also used to automate some routine, relatively easy way in many cases.

Next, we explain how to enter shutdown commands in CMD and the syntax of some of them. We also present several options to turn off the equipment ..

Step One: Open Command Prompt to Enter Shutdown Commands

If you want to use the Windows cmd.exe to enter the shutdown commands , you can open it in two ways, depending on your computer usage preferences:

  • Open the search box with a mouse click and enter cmd
  • Open? Run? with a keyboard shortcut and enter cmd

Open the search box with the mouse and type cmd

  1. Click the search box on the Windows taskbar, at the bottom left of the screen:
image
You can open the Windows command prompt (cmd.exe) using the search box.
  1. Enter the letters cmd in the search field:
image
Menu to open the Windows command prompt or select other options.
  1. Press the return key or click? Open ? with the mouse.

As you see in the image, there are different options. You can open the command prompt with limited rights or run it as administrator by selecting the corresponding option. In the second case, you can use cmd.exe with extended access rights. The only requirement is that administrator rights have been expressly granted to the active user account with which you are logged into Windows.

Note

Normal mode is usually sufficient to run the shutdown commands . It is only recommended to enable administrator mode when it is not possible to execute the desired commands in normal mode. However, it should be noted that administrator rights grant broad powers to programs. For example, if someone has been infected by a virus, it could damage the system.

Open? Run? with a keyboard shortcut and type cmd

If you prefer to navigate the operating system using keyboard shortcuts, you can also open the command prompt with this method:

  1. Press the [Windows] + [R] keys at the same time (the Windows key is marked with the flag icon).
  2. Enter the letters cmd in the search field that opens and press the return key or click? Accept ?:
image
You can use the window? Run? to open the Windows command prompt by entering? cmd? and confirming with? OK? or the return key.

Shutdown with CMD: how to use the command line

Both methods cause Windows to open the command prompt in another window, in which you can now type the shutdown command :

image
[USERNAME] is a placeholder for the name of the active user or administrator account in this case.

The Windows command line can process many shutdown commands . To do this, the names and control parameters must follow the appropriate (command) syntax . In this case, the basic syntax is as follows:

  shutdown /parámetro  

The shutdown commands are made up of the basic shutdown command and other control parameters. The latter indicate, for example, whether the system should be shut down (/ s) or restarted (/ r). It is always possible to combine several parameters.

The most important CMD shutdown commands

Here is a table of the most important Windows shutdown commands that can be run through the command prompt.

advice

Windows 10 Command Prompt supports copy and paste function . You can copy the commands from this article (with the keyboard shortcut Ctrl + C) and then paste them (with the keyboard shortcut Ctrl + V) into the command line window. Keep in mind that running programs could close without warning, with the consequent loss of data, so you should finish the most important ones and save the data beforehand.

shutdown / s Immediately shut down the computer
shutdown / a Cancel shutdown
shutdown / r Restart your computer
shutdown / l Log out of current user
shutdown / f Force shutdown (forces all running applications to close without warning the user)

The mentioned commands are automatic and do not need further instructions. There are also other more sophisticated CMD shutdown procedures , which have a more complex syntax. These are some examples:

shutdown / s / t 20 Shut down the computer after 20 seconds (the time period for the parameter? / T? Is freely selectable)
shutdown / r / m \\ computer name Restart the remote computer with that name (may need to be prepared, such as granting access rights for remote control or configuring the firewall)
shutdown / r / m \\ hostname / c? comment? Restart the remote computer (the text following the? / C? Parameter appears in a blue text box on the remote computer screen)

Example: shut down the local computer after 20 seconds

The local computer will be shut down in 20 seconds from the active user account, named? Peter ?:

image
Example of a simple shutdown command that shuts down the computer after a period of time.

Example: shutting down a remote computer after one minute

A remote computer [MY REMOTE PC] should turn off after 60 seconds . During the countdown to shutdown, the remote computer screen should display a text box with the comment ? Please finish your tasks ?. The following syntax implements the command:

*** CODE

shutdown / s / m \\ [MY REMOTE PC] / t 60 / c? Please finish your tasks?

  shutdown /s /m \\[MI PC REMOTO] /t 60 /c ?Por favor, finalice sus tareas?  

When formulating the syntax, you must replace the entire [MY REMOTE PC] placeholder (including the square brackets) with your computer data. Comments are enclosed in high quotes.

image
Example of a more complex shutdown syntax. The remote computer shuts down after a while.

If the command is successful, the following standard Windows window will appear on the remote computer screen with the comment? Please finish your tasks ?:

image
Blue text box on remote computer after remote shutdown via command line.

Advanced users of Windows shutdown commands can define quite complex shutdown procedures for very specific purposes. If you type shutdown /? At the Windows command prompt, a list of basic commands will appear.

Other options for shutting down the computer

You do not have to use the command prompt to shut down Windows in different ways. The shutdown routines can also be triggered by a script (batch file) that executes the desired commands immediately without opening the CMD. Such files can be easily created with Windows Notepad, saved as a .bat file, and executed with a click of the mouse:

Example file name: shutdown_PC.bat

  @echo off shutdown /s /t 20  

When it comes to creating and testing batch files, there are several things to consider. This video describes all the necessary preparations in detail:

To protect your privacy, the video will be uploaded after clicking.

Another option to shut down your computer as quickly as possible is to create a shortcut in Windows . Right click on the Windows desktop to open the context menu, select? New? and then? Shortcut ?:

image
Shortcut to shut down the computer: open the menu to create it by right clicking on the Windows desktop.

In the window that opens, there is a text field where you can also enter code. Follow these steps to quickly create a desktop shutdown shortcut:

  • Enter shutdown / s / t 20
  • Click? Next ?
  • Give it an easy to recognize name
  • Confirm by clicking on? Finish ?

Clicking on the link will shut down your computer after 20 seconds.

image
When creating a shortcut to shut down your computer, you can directly enter the shutdown command.
image
Give an easy to recognize name to the shortcut with which to turn off your computer.

...