What is the command line to restart windows

Reboot Windows computer from command line (CMD)

We can reboot a Windows computer from command line using the in-built shutdown command.В Below you can find syntax of this command for various use cases. The below commands work on Windows 7, Windows 8, Windows 10 and all other server editions.

Command to reboot windows computer

The above command will set a time out of 30 seconds to close the applications. After 30 seconds, windows reboot will start.

If you want to reboot Windows with your own time out value you can use the below command.

To shutdown a Windows computer

To abort computer reboot

If you have issued a reboot command and have changed mind, you can stop Windows reboot by running the below command.

When you run this, you would see a pop up window at the right bottom part of the screen(near system tray) that shows the message “The scheduled shutdown has been cancelled”.

To force reboot by closing applications without warning

Open the shutdown GUI

Add reason for the reboot of the computer

Reboot Windows using WMIC commands:

Reboot windows using WMIC

You can run the below wmic command to reboot Windows OS.

Is the abort command supposed to work if one has issued the reboot from GUI. I have tried this on my Windows 7 Ultimate, it does not seem to be working. it says ‘no shutdown was in progress’

Abort works only when you had issued the reboot/shutdown using the command. GUI actions are not aborted by /a option.

I’ve just attempted all commands from Windows 7 Ultimate install disk (used as recovery disk) and I obviously have a fault with my disk trying to load the Windows installation volume, I’ve launched command prompt via shift F10 as the GUI was not responding or should I say it had a never ending hour glass, trying a force shut down resulted in ‘the function is unknown’ proceeded with some numerical digits inside of closed brackets?

Shutdown /a is very handy when windows update tries to force reboot your computer. You can run this command and cancel the reboot if you don’t want the reboot to happen at that time.

How to restart Microsoft Windows

Restarting your computer is necessary for many common tasks, including installing new software and performing Windows Updates. This page contains multiple methods for restarting Windows. To proceed, select the method you would like to use from the list below or read through each section individually.

If the computer is frozen or the keyboard and mouse do not work, press and hold down the power button until the computer turns off. Once the computer is off, you can turn the computer back on to restart the computer.

Читайте также:  Ошибка обновления линукс минт

If the computer has a blue screen or another error, try the Ctrl + Alt + Del shortcut method of rebooting.

Restarting from the Windows desktop

In any version of Windows, navigate to the desktop and press Alt + F4 on your keyboard. Doing so brings up a menu similar to the one displayed below. Click the down arrow for the drop-down list, select Restart, and click OK.

Restarting through the Start menu

Windows 10

The Start menu returns in Windows 10, allowing users to easily access the power options again.

  1. Click Start in the lower-left corner of the screen.
  2. Click the Power option.
  3. In the Power menu, select the Restart option.

Windows 8 and 8.1

Neither of these versions of Windows has the Start menu. However, with the 8.1 update, Microsoft added the power options button to the upper-right corner of the Start screen that allows users to restart their computer quickly. Click the power options icon (squared in red in the image below) and select Restart from the drop-down menu that appears.

Windows Vista and 7

In both Windows Vista and Windows 7, users may restart their computer through the Start menu using the following steps:

  1. Click Start in the lower-left corner of the Windows desktop.
  2. Locate and click the right arrow (shown below) next to the Shut down button.
  3. Select Restart from the menu that appears.

Windows XP and prior versions

  1. Click Start in the lower-left corner of the screen.
  2. Click the Shut Down button.
  3. Select Restart in the drop-down menu that appears.
  4. Click OK.

Using Ctrl+Alt+Delete to restart

If you press the Ctrl + Alt + Del keys on your keyboard simultaneously, it brings up an administrative menu. This menu differs between versions of Windows, but each one allows users access to the Restart function. Instructions for each version are shown in the following sections.

If the computer has a blue screen or another error, try the Ctrl + Alt + Del method of rebooting.

Windows 10

In Windows 10, pressing Ctrl + Alt + Del takes you to the Windows lock screen. To restart Windows:

  1. Locate and click the power icon in the lower-right corner of the lock screen. It should be the icon furthest to the right.
  2. Select Restart from the menu that appears.

Windows 8

Users of the Windows 8 will be taken to the Windows lock screen upon pushing Ctrl + Alt + Del . To restart Windows:

  1. Locate and click the black power button in the lower-right corner of the screen.
  2. Select Restart from the menu that appears.

Windows Vista and 7

In Windows Vista and 7, pressing Ctrl + Alt + Del takes users to the Windows lock screen containing several options. In the lower-right corner, there is a red button with an arrow next to it. Clicking this button opens a list of shutdown options, as you can see in the image. To restart your computer using this menu:

  1. Click the red arrow to open the menu.
  2. Select Restart to reboot your machine.

Windows XP and prior

In Windows XP and earlier, Ctrl + Alt + Del brings up the Windows Security screen. To restart:

  1. Click the Shut Down button.
  2. In the new window that appears, click the down arrow and select Restart from the drop-down menu.
  3. Click OK.

Using the Windows command line

You can shut down or restart a Windows computer using the Windows command prompt by following the steps below.

  1. Open the Windows Command Prompt.
  2. To shut down Windows, type shutdown -s and press Enter .
  3. To restart Windows, type shutdown -r and press Enter .

If you are accessing Windows on a computer through a remote desktop connection and execute the shutdown or restart command, the remote desktop connection will be terminated. If you executed the restart command, you can reconnect to that computer once it has restarted. If you executed the shutdown command, you can’t reconnect to and start up that computer remotely.

Читайте также:  Все для windows phone 630

How to reboot from an error message

If the computer encounters an error, you can reboot or restart the computer by pressing the Ctrl + Alt + Del keys all at the same time. If these keys do not work, you can also perform the physical restart mentioned below.

Physical restart with button on computer

You can use the computer’s power button to restart. Press the power button once and wait for the computer to shut down. Press the power button again to turn the computer back on.

If your computer is frozen or does not turn off, press and hold the power button for five seconds to shut the computer off. This action is known as a hard reset and should only be done if all of the above options do not work.

Some computers also have a reset button next to or below the power button.

Start or stop Windows service from command line (CMD)

We normally use Services.msc to start or stop or disable or enable any service. We can do the same from windows command line also using net and sc utilities. Below are commands for controlling the operation of a service.

Command to stop a service:

To start a service:

You need to have administrator privileges to run net start/stop commands. If you are just a normal user on the computer, you would get an error like below.

To disable a service:

To enable a service:

To make a service start automatically with system boot:

Note: Space is mandatory after ‘=’ in the above sc commands.

This SC command works on a Windows 7 machine and also on the down-level editions of Windows i.e Windows XP/2003 and Windows Vista. Again, if you do not have administrator previliges you would get the below error.

Note that the service name is not the display name of a service. Each service is given a unique identification name which can be used with net or sc commands. For example, Remote procedure call (RPC) is the display name of the service. But the service name we need to use in the above commands is RpcSs.
So to start Remote procedure call service the command is:

These service names are listed below for each service. The first column shows the display name of a service and the second column shows the service name that should be used in net start or net stop or sc config commands.

How do I shutdown, restart, or log off Windows via a bat file?

I’ve been using Remote Desktop Connection to get into a workstation. But in this environment, I cannot use the power options in Start Menu. I need an alternative way to shutdown or restart.

How do I control my computer’s power state through the command line?

10 Answers 10

The most common ways to use the shutdown command are:

  • shutdown -s — Shuts down.
  • shutdown -r — Restarts.
  • shutdown -l — Logs off.

shutdown -h — Hibernates.

Note: There is a common pitfall wherein users think -h means «help» (which it does for every other command-line program. except shutdown.exe , where it means «hibernate»). They then run shutdown -h and accidentally turn off their computers. Watch out for that.

shutdown -i — «Interactive mode». Instead of performing an action, it displays a GUI dialog.

  • shutdown -a — Aborts a previous shutdown command.
  • The commands above can be combined with these additional options:

    • -f — Forces programs to exit. Prevents the shutdown process from getting stuck.
    • -t — Sets the time until shutdown. Use -t 0 to shutdown immediately.
    • -c — Adds a shutdown message. The message will end up in the Event Log.

    -y — Forces a «yes» answer to all shutdown queries.

    Note: This option is not documented in any official documentation. It was discovered by these StackOverflow users.

    I want to make sure some other really good answers are also mentioned along with this one. Here they are in no particular order.

    How to Restart or Shutdown a Remote Computer

    There will be times as a Windows Administrator that you will need to reboot or shutdown a remote computer or server.

    In this tutorial, I’ll show you two easy methods for rebooting and shutting down remote computers.

    The first method uses a built in Windows command and the second method uses PowerShell.

    Windows Shutdown Command

    Windows systems has a built in shutdown command that can be used to restart or shutdown local and remote computers.

    The command is shutdown.

    To use this command just open the windows command prompt and type shutdown.

    To view the full list of command options type shutdown /? in the CMD window.

    There are several command line switches, below I list the most useful options.

    /s – Shutdown the computer

    /r – restart computer

    /m \\computer – Specify the remote computer

    /t xxx – Set the time out period before shutdown to xxx seconds

    /c “comment” – Message to display on the screen before restart or shutdown

    Now lets move onto some examples

    Restart or Shutdown Examples with Command Line

    In these examples, I’ll be on PC1 and will initiate a remote restart or shutdown on PC2.

    I’ll be using the /r switch in these examples, you can change them to /s to shutdown instead of restart.

    Example 1: Restart Remote Computer

    By default, this will prompt the remote computer and give it about a minute before it restarts.

    The pop up below is what a Windows 10 system will display.

    Example 2: Restart With a Custom Message

    You may want to display a custom message to the logged on users, to do that just use the /c command.

    Below is the pop up on the remote computer with the custom message.

    Example 3: Immediate Restart no Countdown

    If you want to immediately restart with no countdown or message use this command.

    If you want a longer countdown just specify the seconds /t 60

    Example 4: Log user off remote computer

    If you just want to log a user off the remote computer use this command.

    Restart or Shutdown with Powershell

    Here are a few examples of how you can restart or shutdown computers with PowerShell.

    The downside to PowerShell is it doesn’t have as many options as the shutdown command. There is no option to prompt users with a custom message or provide a countdown.

    Example 1: Use Powershell to restart a computer

    This command will immediately restart a remote computer. The -Force option will force a restart even if a user is logged on.

    Example 2: Use PowerShell to shutdown a computer

    This command will shutdown a remote computer. Use the -Force to force a shutdown even if a user is logged on.

    Example 3: Use PowerShell to restart a list of computers

    This is handy if you have several computers to restart. Just list all the computers you want in a text file and add that to the PowerShell command.

    Example 4: Use PowerShell to shutdown down two computers

    Recommended Tool: SolarWinds Server & Application Monitor

    This utility was designed to Monitor Active Directory and other critical services like DNS & DHCP. It will quickly spot domain controller issues, prevent replication failures, track failed logon attempts and much more.

    What I like best about SAM is it’s easy to use dashboard and alerting features. It also has the ability to monitor virtual machines and storage.

    Читайте также:  Mac windows способы установки
    Оцените статью