4 Ways to Shut Down or Restart a Computer Using Command Prompt

Table of contents:

4 Ways to Shut Down or Restart a Computer Using Command Prompt
4 Ways to Shut Down or Restart a Computer Using Command Prompt
Anonim

The Command Prompt is a feature built into all versions of Windows that allows you to execute MS-DOS ("MicroSoft Disk Operating System") and system commands within your computer. You can use the "Command Prompt" to shut down or restart a Windows computer remotely. The "Command Prompt" also allows you to access the "Remote Shutdown" dialog. To be able to shut down a Windows computer remotely, you must have access to the machine as a system administrator, and file and printer sharing must be enabled.

Steps

Method 1 of 4: Using the Command Prompt

Shut Down or Restart Another Computer Using CMD Step 1
Shut Down or Restart Another Computer Using CMD Step 1

Step 1. Access the "Start" menu by clicking on the icon

Windowsstart
Windowsstart

It features the Windows logo and is located in the lower left corner of the desktop.

Shut Down or Restart Another Computer Using CMD Step 2
Shut Down or Restart Another Computer Using CMD Step 2

Step 2. Type in the keyword cmd

A "Command Prompt" search will be performed within your computer and the results list will appear directly in the "Start" menu.

Shut Down or Restart Another Computer Using CMD Step 3
Shut Down or Restart Another Computer Using CMD Step 3

Step 3. Select the Command Prompt icon with the right mouse button

It is characterized by a black screen inside which a prompt in white characters is visible. Select the icon with the right mouse button to display the corresponding menu.

Shut Down or Restart Another Computer Using CMD Step 4
Shut Down or Restart Another Computer Using CMD Step 4

Step 4. Click on the Run as administrator option

The "Command Prompt" window will appear. The program will start with the access rights of the computer administrator.

To be able to perform this step, you must be logged in to Windows with a user account that is system administrator

Shut Down or Restart Another Computer Using CMD Step 5
Shut Down or Restart Another Computer Using CMD Step 5

Step 5. Type the shutdown command in the "Command Prompt" window

This is the command that allows you to shut down a Windows computer from the "Command Prompt".

To see the complete list of all the parameters of the "shutdown" command, execute the command shutdown /? within the "Command Prompt" window

Shut Down or Restart Another Computer Using CMD Step 6
Shut Down or Restart Another Computer Using CMD Step 6

Step 6. Enter the parameters m / computer_name

After entering the "shutdown" command, leave a space and enter the indicated parameters. Replace the keyword "computer_name" with the name of the computer you want to shut down remotely.

Shut Down or Restart Another Computer Using CMD Step 7
Shut Down or Restart Another Computer Using CMD Step 7

Step 7. Type the / s or / r parameter after the target computer name

Again, separate the parameter under consideration and the computer name with a blank space. If you need to shut down your computer, use the "/ s" parameter. If you want to restart it instead, use the "/ r" parameter.

Shut Down or Restart Another Computer Using CMD Step 8
Shut Down or Restart Another Computer Using CMD Step 8

Step 8. Add the / f parameter

After entering the characters "/ s" or "/ r", enter a blank space as a separator. Doing so will force close all open and running programs on the remote computer.

  • Note:

    in this scenario, by forcing the shutdown of running programs, the user who is using the computer could lose his work if he did not save it in advance. Read on to find out how to warn the user about the imminent shutdown or restart of the machine they are working on and how to give them time to save all their data.

  • At this point, the complete command should look like this: shutdown / workspace1 / r / f. Press the Enter key to execute the command and remotely restart the indicated computer. In this case, the restart will be performed immediately. Read on to add a timer before the computer restarts and to alert you with a message.
Shut Down or Restart Another Computer Using CMD Step 9
Shut Down or Restart Another Computer Using CMD Step 9

Step 9. Add the / c parameter

Insert a blank space after the "/ f" parameter before inserting the one indicated. This way, you can send a message to the user who is currently using the computer that you want to reboot or shut down remotely.

Shut Down or Restart Another Computer Using CMD Step 10
Shut Down or Restart Another Computer Using CMD Step 10

Step 10. Type the message you want in quotation marks

Again, first leave a blank after the "/ c" parameter. The message is intended to alert the user that the computer they are working on will be restarted or shut down. For example, you could use the message "This computer is about to restart, please immediately save all your work". Be sure to enclose the warning message in quotation marks ("").

Shut Down or Restart Another Computer Using CMD Step 11
Shut Down or Restart Another Computer Using CMD Step 11

Step 11. Add the / t parameter followed by a time interval in seconds

Again, type blank space first to separate the new command parameter from the old one. This will give the user time (indicated by the number of seconds you have chosen) to save all their data before the computer is restarted or shut down. For example, the / t 60 parameter delays the execution of the command by 60 seconds, after which the computer will be shut down or restarted.

Shut Down or Restart Another Computer Using CMD Step 12
Shut Down or Restart Another Computer Using CMD Step 12

Step 12. Press the Enter key

The command will be executed. At this point the complete command should look like this: shutdown m / workspace1 / r / f / c "This computer will restart in 60 seconds. Please save all your work immediately." / t 60.

  • If a message similar to the following appears Access Denied or Access denied, make sure you are logged in to Windows with a system administrator account and have the same access rights on the target computer as well. Refer to the third method of the article to find out how to enable file and printer sharing on both computers by changing the Windows Firewall settings.
  • If you do not have the possibility to connect to the registry of the target computer, refer to the fourth method of the article to find out how to do it and how to modify it remotely.

Method 2 of 4: Using the Remote Shutdown Dialog

Shut Down or Restart Another Computer Using CMD Step 13
Shut Down or Restart Another Computer Using CMD Step 13

Step 1. Access the "Start" menu by clicking on the icon

Windowsstart
Windowsstart

It features the Windows logo and is located in the lower left corner of the desktop.

Shut Down or Restart Another Computer Using CMD Step 14
Shut Down or Restart Another Computer Using CMD Step 14

Step 2. Type in the keyword cmd

A "Command Prompt" search will be performed within your computer and the results list will appear directly in the "Start" menu.

Shut Down or Restart Another Computer Using CMD Step 15
Shut Down or Restart Another Computer Using CMD Step 15

Step 3. Select the Command Prompt icon with the right mouse button

It is characterized by a black screen inside which a prompt in white characters is visible. Select the icon with the right mouse button to display the corresponding menu.

Shut Down or Restart Another Computer Using CMD Step 16
Shut Down or Restart Another Computer Using CMD Step 16

Step 4. Click on the Run as administrator option

The "Command Prompt" window will appear. The program will start with the access rights of the computer administrator.

To be able to perform this step, you must be logged in to Windows with a user account that is the system administrator

Shut Down or Restart Another Computer Using CMD Step 17
Shut Down or Restart Another Computer Using CMD Step 17

Step 5. Type the command shutdown -i in the "Command Prompt" window and press the Enter key

The "Remote Shutdown" dialog will be displayed.

Shut Down or Restart Another Computer Using CMD Step 18
Shut Down or Restart Another Computer Using CMD Step 18

Step 6. Click the Add button

It is located to the right of the "Computer" text box.

Shut Down or Restart Another Computer Using CMD Step 19
Shut Down or Restart Another Computer Using CMD Step 19

Step 7. Type the IP address of the target computer (or computers), then click the OK button

The target computer is the machine you want to reboot or shut down remotely. Enter the IP address of the computer in question in the "Add Computer" pop-up, then click on the button OK.

If you don't know the local IP address of the target computer, you can find this information using your computer and these instructions

Shut Down or Restart Another Computer Using CMD Step 20
Shut Down or Restart Another Computer Using CMD Step 20

Step 8. Choose whether to restart or shut down the target computer

Use the "Choose one of the following options:" drop-down menu to select "Shut Down" or "Restart".

Shut Down or Restart Another Computer Using CMD Step 21
Shut Down or Restart Another Computer Using CMD Step 21

Step 9. Click the check button

Windows10regchecked
Windows10regchecked

"Notify users" (optional).

This step allows you to set a timer before the computer is actually shut down or restarted.

Shut Down or Restart Another Computer Using CMD Step 22
Shut Down or Restart Another Computer Using CMD Step 22

Step 10. Type the number of seconds to wait before the computer actually turns off (optional)

Enter the chosen value in the text field "Display warning for [number] seconds". In this way, the execution of the shutdown command will be delayed by the indicated number of seconds.

Shut Down or Restart Another Computer Using CMD Step 23
Shut Down or Restart Another Computer Using CMD Step 23

Step 11. Click the check button

Windows10regchecked
Windows10regchecked

"Planned" (optional).

This step allows you to track the remote reboot or shutdown within the target machine's event log.

Shut Down or Restart Another Computer Using CMD Step 24
Shut Down or Restart Another Computer Using CMD Step 24

Step 12. Select the reason for the forced shutdown or restart (optional)

Use the "Option" drop-down menu to select the reason why remote shutdown or reboot was required. For example "Hardware: maintenance (planned)".

Shut Down or Restart Another Computer Using CMD Step 25
Shut Down or Restart Another Computer Using CMD Step 25

Step 13. Add a comment (optional)

This message will be displayed on the target computer screen. For example, you can use a message similar to the following: "This computer will be shut down in 60 seconds. Please immediately save all your work".

Shut Down or Restart Another Computer Using CMD Step 26
Shut Down or Restart Another Computer Using CMD Step 26

Step 14. Click the OK button

The shutdown or restart command will be executed.

  • If a message similar to the following appears Access Denied or Access denied, make sure you are logged in to Windows with a system administrator account and have the same access rights on the target computer as well. Refer to the third method of the article to find out how to enable file and printer sharing on both computers by changing the Windows Firewall settings.
  • If you do not have the possibility to connect to the registry of the target computer, refer to the fourth method of the article to find out how to do it and how to modify it remotely.

Method 3 of 4: Enable File and Printer Sharing Using the Windows Firewall

Shut Down or Restart Another Computer Using CMD Step 27
Shut Down or Restart Another Computer Using CMD Step 27

Step 1. Go to the Windows "Control Panel"

To perform this step follow these instructions:

  • Click on the Windows "Start" menu icon;
  • Type in the control panel keywords;
  • Click on the icon Control panel.
Shut Down or Restart Another Computer Using CMD Step 28
Shut Down or Restart Another Computer Using CMD Step 28

Step 2. Click on the Network and Internet link

It is green in color and placed next to an icon depicting two computer screens and a globe.

If the indicated link is not visible, skip this step

Shut Down or Restart Another Computer Using CMD Step 29
Shut Down or Restart Another Computer Using CMD Step 29

Step 3. Click on the Network and Sharing Center option

It is characterized by an icon depicting four computers connected to each other.

Shut Down or Restart Another Computer Using CMD Step 30
Shut Down or Restart Another Computer Using CMD Step 30

Step 4. Click the Change Advanced Sharing Settings link

It is displayed on the left side of the "Control Panel" window.

Shut Down or Restart Another Computer Using CMD Step 31
Shut Down or Restart Another Computer Using CMD Step 31

Step 5. Click on the radio button Enable Network Discovery

This will enable the "Network Discovery" feature.

Shut Down or Restart Another Computer Using CMD Step 32
Shut Down or Restart Another Computer Using CMD Step 32

Step 6. Click on the radio button Enable file and printer sharing

This will enable file and printer sharing on your computer.

Shut Down or Restart Another Computer Using CMD Step 33
Shut Down or Restart Another Computer Using CMD Step 33

Step 7. Click the Save Changes button

It is located in the lower right corner of the window.

Shut Down or Restart Another Computer Using CMD Step 34
Shut Down or Restart Another Computer Using CMD Step 34

Step 8. Click on the Network and Internet link

It is displayed in the address bar of the "Control Panel" window. You will be redirected back to the "Network and Internet" screen of the "Control Panel".

Shut Down or Restart Another Computer Using CMD Step 35
Shut Down or Restart Another Computer Using CMD Step 35

Step 9. Click on the System and Security option

It is located on the left side of the window.

Shut Down or Restart Another Computer Using CMD Step 36
Shut Down or Restart Another Computer Using CMD Step 36

Step 10. Click the Allow app through Windows Firewall link

It is the second entry listed under the "Windows Defender Firewall" link.

Shut Down or Restart Another Computer Using CMD Step 37
Shut Down or Restart Another Computer Using CMD Step 37

Step 11. Click the check button

Windows10regchecked
Windows10regchecked

located next to "File and Printer Sharing".

It is one of the options listed in the "Allowed apps and features" section.

Shut Down or Restart Another Computer Using CMD Step 38
Shut Down or Restart Another Computer Using CMD Step 38

Step 12. Click the check button

Windows10regchecked
Windows10regchecked

"Private".

It is located to the right of the "File and Printer Sharing" option within the "Allowed apps and features" section.

Shut Down or Restart Another Computer Using CMD Step 39
Shut Down or Restart Another Computer Using CMD Step 39

Step 13. Click the OK button

It is located at the bottom of the "Control Panel" window. This way, the changes will be saved and applied.

Method 4 of 4: Edit the Windows Registry

Shut Down or Restart Another Computer Using CMD Step 40
Shut Down or Restart Another Computer Using CMD Step 40

Step 1. Access the "Start" menu by clicking on the icon

Windowsstart
Windowsstart

It features the Windows logo and is located in the lower left corner of the desktop. In new versions of Windows, when trying to log into a computer remotely, system administrator access privileges are often removed. To work around this problem, you need to manually edit the Windows registry.

Shut Down or Restart Another Computer Using CMD Step 41
Shut Down or Restart Another Computer Using CMD Step 41

Step 2. Type the keyword regedit into the "Start" menu

The Windows Registry Editor icon will appear.

  • Attention:

    modifying or deleting keys and items contained in the Windows registry can irreparably damage the operating system. For this reason, proceed with extreme caution and attention.

Shut Down or Restart Another Computer Using CMD Step 42
Shut Down or Restart Another Computer Using CMD Step 42

Step 3. Click on the Regedit icon

The Windows Registry Editor window will appear.

Shut Down or Restart Another Computer Using CMD Step 43
Shut Down or Restart Another Computer Using CMD Step 43

Step 4. Access the "System" folder contained in the "Policies" directory

To navigate the Windows registry, you can use the tree menu displayed in the left pane of the editor window. Follow these instructions to access the contents of the "System" folder stored in the "Policies" directory:

  • Double-click the entry HKEY_LOCAL_MACHINE;
  • Double-click the folder SOFTWARE;
  • Double-click the folder Microsoft;
  • Double-click the folder Windows;
  • Double-click the folder CurrentVersion;
  • Double-click the folder Policies;
  • Double-click the folder System.
Shut Down or Restart Another Computer Using CMD Step 44
Shut Down or Restart Another Computer Using CMD Step 44

Step 5. Create a new "DWORD" value

Follow these instructions to create a new "DWORD" value inside the "System" folder.

  • Right-click an empty spot in the main frame of the Registry Editor window;
  • Move the mouse pointer over the item New one;
  • Click on the DWORD (32-bit) Value option.
Shut Down or Restart Another Computer Using CMD Step 45
Shut Down or Restart Another Computer Using CMD Step 45

Step 6. Name the DWORD value you just created "LocalAccountTokenFilterPolicy"

When you create a new DWORD entity, the temporary name appears highlighted in blue. To rename it, simply type in the new name, which is "LocalAccountTokenFilterPolicy".

Shut Down or Restart Another Computer Using CMD Step 46
Shut Down or Restart Another Computer Using CMD Step 46

Step 7. At this point, right-click on LocalAccountTokenFilterPolicy

A context menu will appear to the right of the chosen value.

Shut Down or Restart Another Computer Using CMD Step 47
Shut Down or Restart Another Computer Using CMD Step 47

Step 8. Click on the Edit option

A new pop-up will appear that will allow you to edit the DWORD value you created.

Shut Down or Restart Another Computer Using CMD Step 48
Shut Down or Restart Another Computer Using CMD Step 48

Step 9. Set the value of the new DWORD entity to "1"

Use the "Value data" text field to change the present value from "0" to "1".

Shut Down or Restart Another Computer Using CMD Step 49
Shut Down or Restart Another Computer Using CMD Step 49

Step 10. Click the OK button

The new DWORD entity value will be stored. At this point you can close the Registry Editor window.

Advice

  • In order to use the procedures described in the article, you should know the IP address of the target computer.
  • Type the command shutdown /? within the "Command Prompt" to view the complete list of all the parameters it provides.

Recommended: