Shutdown windows from the command line

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.

shutdown

Enables you to shut down or restart local or remote computers, one at a time.

Syntax

Parameters

Parameter Description
/i Displays the Remote Shutdown box. The /i option must be the first parameter following the command. If /i is specified, all other options are ignored.
/l Logs off the current user immediately, with no time-out period. You cannot use /l with /m or /t.
/s Shuts down the computer.
/sg Shuts down the computer. On the next boot, if Automatic Restart Sign-On is enabled, the device automatically signs in and locks based on the last interactive user. After sign in, it restarts any registered applications.
/r Restarts the computer after shutdown.
/g Shuts down the computer. On the next restart, if Automatic Restart Sign-On is enabled, the device automatically signs in and locks based on the last interactive user. After sign in, it restarts any registered applications.
/a Aborts a system shutdown. Effective only during the time-out period. To use /a, you must also use the /m option.
/p Turns off the local computer only (not a remote computer)—with no time-out period or warning. You can use /p only with /d or /f. If your computer doesn’t support power-off functionality, it will shut down when you use /p, but the power to the computer will remain on.
/h Puts the local computer into hibernation, if hibernation is enabled. You can use /h only with /f.
hybrid Shuts down the device and prepares it for fast startup. This option must be used with the /s option.
/fw Combining this option with a shutdown option causes the next restart to go to the firmware user interface.
/e Enables you to document the reason for the unexpected shutdown on the target computer.
/o Goes to the Advanced boot options menu and restarts the device. This option must be used with the /r option.
/f Forces running applications to close without warning users.
Caution: Using the /f option might result in loss of unsaved data.
/m \\ Specifies the target computer. Can’t be used with the /l option.
/t Sets the time-out period before shutdown to xxx seconds. The valid range is 0-315360000 (10 years), with a default of 30. If the timeout period is greater than 0, the /f parameter is implied.
/d [p | u:] : Lists the reason for the system restart or shutdown. The supported parameter values are:
  • p — Indicates that the restart or shutdown is planned.
  • u — Indicates that the reason is user-defined.

NOTE
If p or u aren’t specified, the restart or shutdown is unplanned.

  • xx — Specifies the major reason number (a positive integer, less than 256).
  • yy Specifies the minor reason number (a positive integer, less than 65536).
  • /c Enables you to comment in detail about the reason for the shutdown. You must first provide a reason by using the /d option and you must enclose your comments in quotation marks. You can use a maximum of 511 characters. /? Displays help at the command prompt, including a list of the major and minor reasons that are defined on your local computer.

    Remarks

    Users must be assigned the Shut down the system user right to shut down a local or remotely administered computer that is using the shutdown command.

    Users must be members of the Administrators group to annotate an unexpected shutdown of a local or remotely administered computer. If the target computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. For more information, see:

    If you want to shut down more than one computer at a time, you can call shutdown for each computer by using a script, or you can use shutdown /i to display the Remote Shutdown box.

    If you specify major and minor reason codes, you must first define these reason codes on each computer where you plan to use the reasons. If the reason codes aren’t defined on the target computer, Shutdown Event Tracker can’t log the correct reason text.

    Remember to indicate that a shutdown is planned by using the p parameter. Not using the p parameter, indicates that the shutdown was unplanned.

    Using the p parameter, along the reason code for an unplanned shutdown, causes the shutdown to fail.

    Not using the p parameter, and only providing the reason code for an planned shutdown, also causes the shutdown to fail

    Examples

    To force apps to close and to restart the local computer after a one-minute delay, with the reason Application: Maintenance (Planned) and the comment «Reconfiguring myapp.exe», type:

    To restart the remote computer myremoteserver with the same parameters as the previous example, type:

    shutdown shutdown

    Позволяет выключать или перезагружать локальные или удаленные компьютеры по одному за раз. Enables you to shut down or restart local or remote computers, one at a time.

    Синтаксис Syntax

    Параметры Parameters

    Параметр Parameter Описание Description
    /i /i Отображает поле Remote Shutdown (удаленное завершение работы ). Displays the Remote Shutdown box. Параметр /i должен быть первым параметром после команды. The /i option must be the first parameter following the command. Если указан параметр /i , все остальные параметры игнорируются. If /i is specified, all other options are ignored.
    /l /l Немедленное отключение текущего пользователя без периода ожидания. Logs off the current user immediately, with no time-out period. Параметр /l нельзя использовать с параметрами/m и /t. You cannot use /l with /m or /t.
    /s /s Завершает работу компьютера. Shuts down the computer.
    /сг /sg Завершает работу компьютера. Shuts down the computer. При следующей загрузке, если включен Автоматический вход в систему , устройство автоматически подписывается и блокируется на основе последнего интерактивного пользователя. On the next boot, if Automatic Restart Sign-On is enabled, the device automatically signs in and locks based on the last interactive user. После входа в систему перезапускаются все зарегистрированные приложения. After sign in, it restarts any registered applications.
    /r /r Перезапускает компьютер после завершения работы. Restarts the computer after shutdown.
    /g /g Завершает работу компьютера. Shuts down the computer. При следующей перезагрузке, если включен Автоматический вход в систему , устройство автоматически подписывается и блокируется на основе последнего интерактивного пользователя. On the next restart, if Automatic Restart Sign-On is enabled, the device automatically signs in and locks based on the last interactive user. После входа в систему перезапускаются все зарегистрированные приложения. After sign in, it restarts any registered applications.
    /a /a Прерывает завершение работы системы. Aborts a system shutdown. Действует только в течение периода ожидания. Effective only during the time-out period. Чтобы использовать /a, необходимо также использовать параметр /m . To use /a, you must also use the /m option.
    /p /p Отключает только локальный компьютер (не удаленный компьютер), без времени ожидания или предупреждения. Turns off the local computer only (not a remote computer)—with no time-out period or warning. Параметр /p можно использовать только с параметрами /d или /f. You can use /p only with /d or /f. Если компьютер не поддерживает функции выключения питания, он будет выключен при использовании /p, но питание компьютера останется включенным. If your computer doesn’t support power-off functionality, it will shut down when you use /p, but the power to the computer will remain on.
    /h /h Перевод локального компьютера в режим гибернации, если включен режим гибернации. Puts the local computer into hibernation, if hibernation is enabled. Параметр /h можно использовать только с параметром /f. You can use /h only with /f.
    гибридные hybrid Завершает работу устройства и готовит его к быстрому запуску. Shuts down the device and prepares it for fast startup. Этот параметр следует использовать с параметром /s . This option must be used with the /s option.
    /фв /fw Объединение этого параметра с параметром завершения работы приводит к тому, что Следующая перезагрузка переходит к пользовательскому интерфейсу встроенного по. Combining this option with a shutdown option causes the next restart to go to the firmware user interface.
    /e /e Позволяет документировать причину неожиданного завершения работы на целевом компьютере. Enables you to document the reason for the unexpected shutdown on the target computer.
    /o /o Переход в меню дополнительных параметров загрузки и перезагрузка устройства. Goes to the Advanced boot options menu and restarts the device. Этот параметр следует использовать с параметром /r . This option must be used with the /r option.
    /f /f Принудительно закрывает выполнение приложений без предупреждения пользователей. Forces running applications to close without warning users.
    Внимание! Использование параметра /f может привести к утрате несохраненных данных. Caution: Using the /f option might result in loss of unsaved data.
    /m \\ /m \\ Указывает целевой компьютер. Specifies the target computer. Не может использоваться с параметром /l . Can’t be used with the /l option.
    /t /t Задает время ожидания до завершения работы в xxx секунд. Sets the time-out period before shutdown to xxx seconds. Допустимый диапазон — 0-315360000 (10 лет) и значение по умолчанию 30. The valid range is 0-315360000 (10 years), with a default of 30. Если время ожидания больше 0, подразумевается параметр /f . If the timeout period is greater than 0, the /f parameter is implied.
    /d [p | u:] : /d [p | u:] : Список причин перезапуска или завершения работы системы. Lists the reason for the system restart or shutdown. Поддерживаемые значения параметров: The supported parameter values are:
    • p — указывает, что запланирована перезагрузка или завершение работы. p — Indicates that the restart or shutdown is planned.
    • u — указывает, что причина определяется пользователем. u — Indicates that the reason is user-defined.

    ПРИМЕЧАНИЕ.NOTE
    Если значение p или u не указано, то перезагрузка или завершение работы не планируется. If p or u aren’t specified, the restart or shutdown is unplanned.

  • XX — указывает номер основной причины (положительное целое число, которое меньше 256). xx — Specifies the major reason number (a positive integer, less than 256).
  • гг Указывает дополнительный номер причины (положительное целое число, меньшее 65536). yy Specifies the minor reason number (a positive integer, less than 65536).
  • ключей /c Позволяет ввести подробный комментарий о причине завершения работы. Enables you to comment in detail about the reason for the shutdown. Сначала необходимо указать причину с помощью параметра /d . Кроме того, необходимо заключить комментарии в кавычки. You must first provide a reason by using the /d option and you must enclose your comments in quotation marks. Можно использовать до 511 символов. You can use a maximum of 511 characters. /? /? Отображает справку в командной строке, включая список основных и вспомогательных причин, определенных на локальном компьютере. Displays help at the command prompt, including a list of the major and minor reasons that are defined on your local computer.

    Комментарии Remarks

    Пользователям должно быть назначено право » Завершение работы системы» для завершения работы локального или удаленного администрирования компьютера, использующего команду Shutdown . Users must be assigned the Shut down the system user right to shut down a local or remotely administered computer that is using the shutdown command.

    Пользователи должны быть членами группы » Администраторы «, чтобы закомментировать неожиданное завершение работы локального или удаленного администрирования компьютера. Users must be members of the Administrators group to annotate an unexpected shutdown of a local or remotely administered computer. Если конечный компьютер присоединен к домену, эту процедуру могут выполнять члены группы «Администраторы домена» . If the target computer is joined to a domain, members of the Domain Admins group might be able to perform this procedure. Дополнительные сведения см. в разделе: For more information, see:

    Если вы хотите завершить работу несколько компьютеров одновременно, можно вызвать Завершение работы для каждого компьютера с помощью сценария или завершить работу /I , чтобы отобразить поле удаленное завершение работы . If you want to shut down more than one computer at a time, you can call shutdown for each computer by using a script, or you can use shutdown /i to display the Remote Shutdown box.

    Если указываются коды основных и вспомогательных причин, необходимо сначала определить эти коды на каждом компьютере, где планируется использовать причины. If you specify major and minor reason codes, you must first define these reason codes on each computer where you plan to use the reasons. Если коды причин не определены на целевом компьютере, средство регистрации событий завершения работы не сможет зарегистрировать правильный текст причины. If the reason codes aren’t defined on the target computer, Shutdown Event Tracker can’t log the correct reason text.

    Не забудьте указать, что завершение работы запланировано с помощью параметра p . Remember to indicate that a shutdown is planned by using the p parameter. Если параметр p не используется, указывает, что завершение работы было незапланированным. Not using the p parameter, indicates that the shutdown was unplanned.

    Использование параметра p , а также кода причины незапланированного отключения приводит к сбою завершения работы. Using the p parameter, along the reason code for an unplanned shutdown, causes the shutdown to fail.

    Если параметр p не используется и указан только код причины для запланированного завершения работы, также происходит сбой завершения работы. Not using the p parameter, and only providing the reason code for an planned shutdown, also causes the shutdown to fail

    Примеры Examples

    Чтобы принудительно закрыть приложения и перезапустить локальный компьютер по истечении одной минуты, по причине приложения: обслуживание (запланированное) и комментарий «перенастройка myapp.exe», введите: To force apps to close and to restart the local computer after a one-minute delay, with the reason Application: Maintenance (Planned) and the comment «Reconfiguring myapp.exe», type:

    Чтобы перезагрузить удаленный компьютер миремотесервер с теми же параметрами, что и в предыдущем примере, введите: To restart the remote computer myremoteserver with the same parameters as the previous example, type:

    Читайте также:  Как установить обновления windows 10 если они отключены
    Оцените статью