Shutdown r now windows

В Windows доступно несколько команд, которые позволяют выключить или перезагрузить локальный или удаленный компьютер. В этой статье мы рассмотрим, как использовать команду shutdown и PowerShell командлеты Restart-Computer и Stop-Computer для выключения/перезагрузки Windows.

Содержание:

  • Использование команды shutdown в Windows
  • Перезагрузка удаленных компьютеров командой shutdown
  • Перезагрузка и выключение Windows с помощью PowerShell

Использование команды shutdown в Windows

Утилита командной строки shutdown является встроенной командой Windows, которая позволяет перезагрузить, выключить компьютер, перевести его в спящий режим или завершить сеанс пользователя. В этой инструкции мы покажем основные примеры использования команды shutdown в Windows (все рассмотренные команды запускаются в окне Выполнить — Win+R ->, в командной строке cmd.exe или в консоли PowerShell).

Команда shutdown имеет следующий синтаксис:

shutdown [/i | /l | /s | /sg | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f] [/m \\компьютер][/t xxx][/d [p|u]xx:yy [/c "комментарий"]]

команда shutdown синтаксис

Как вы видите, у команды довольно много опций, а также есть возможность выключить/ перезагрузить удаленный компьютере.

Выключение Windows командой Shutdown

Для выключения ОС Windows и компьютера необходимо использовать команду shutdown с ключом /s.

shutdown /s

Перезагрузка Windows

Чтобы перезагрузить компьютер, необходимо добавить параметр /r. После выполнения этой команды Windows корректно перезагрузится.

shutdown /r

Завершение сеанса пользователя

Чтобы завершить текущую сессию пользователя (logout), нужно выполнить команду:

shutdown /l

Эта команда аналогично выполнению команды logoff.

Перевод компьютера в режим гибернации

Для перевода компьютер в режим гибернации (в этом режиме все содержимое памяти записывается в файл hyberfil.sys на диск и компьютер переходит в спящий режим с пониженным электропотреблением), выполните команду:

shutdown /h

Перезагрузка компьютера с сообщением пользователям

Вы можете предупредить всех пользователей Windows о предстоящем выключении / перезагрузки компьютера или сервера, отправив сообщение во все активные сессии (как правило эта возможность используется на терминальных RDS серверах, за которыми одновременно работают несколько пользователей, каждый в своей собственной RDP сессии).

shutdown /r /c “Этот сервер будет перезагружен через 60 секунд.”

Отложенное выключение / перезагрузка компьютера

Можно выключить или перезагрузить компьютер с определенной задержкой (по таймеру). С помощью опции /t можно указать интервал времени (в секундах), через который ПК/сервер будет перезагружен или выключен. Тем самым вы можете предоставить пользователям дополнительное время для того, чтобы успеть сохранить открытые файлы и корректно закрыть приложения. Эту опцию удобно использовать совместно с отправкой сообщения. В этом примере мы указываем, что Windows будет выключена через 10 минут (600 секунд) и информируем пользователей сообщением.

shutdown /s /t 600 /c "Сервер будет выключен через 10 минут. Сохраните свои документы!"

Пользователю будет выдано предупреждение о запланированном выключении: Ваш сеанс будет завершен.

shutdown - Ваш сеанс будет завершен.

Если задержка очень длительная, например, 100 минут (6000 секунд), то вместо предупреждающего окна появляется всплывающее сообщение в нижнем правом углу экрана: «Ваш сеанс будет завершен. Работа Windows будет завершена через 100 мин».

Отмена выключения / перезагрузки компьютера

После запуска команды выключения или перезагрузки Windows, по умолчанию утилита shutdown ожидает 60 секунд, не выполняя никаких действия. Администратор может отменить перезагрузку или выключение устройства, если в течении этого времени успеет выполнить команду:

shutdown /a

После отмены выключения появится всплывающее сообщение в нижнем правом углу экрана: «Выход из системы отменен. Запланировано завершение работы отменено».

shutdown /a - отмена перезагрузки Выход из системы отменен

Перезагрузить Windows немедленно

Чтобы выключить или перезагрузить компьютер немедленно, не ожидая стандартные 60 секунд, нужно указать значение 0 для параметра /t. Например, для немедленной перезагрузки компьютера:

shutdown /r /t 0

Очень важный ключ /f. Я использую его практически всегда при выключении или перезагрузки серверов Windows. Данный атрибут обеспечивает принудительное завершение всех запущенных программ и процессов, не ожидая подтверждения от пользователя (не будем же мы ждать подтверждения закрытия программ от всех пользователей на терминальном сервере, его можно просто не дождаться).

Следующая команда выполнит перезагрузку компьютера с автоматическим запуском всех зарегистрированных приложений после перезагрузки (имеются в виду приложения, зарегистрированные в системе с использованием функции API RegisterApplicationRestart).

shutdown /g

Ярлык для перезагрузки компьютера

Для удобства пользователей вы можете создать на рабочем столе ярлыки для выключения или перезагрузки компьютера с нужными настройками. Такой ярлык может быть полезен для выполнения перезагрузки из RDP сессии, когда отсутствуют кнопки перезагрузки/завершения работы компьютера в меню Пуск.

ярлык на рабочем столе для перезагрузки компьютера

Перезагрузка Windows в определенное время

Чтобы всегда перезагружать/выключать компьютер или сервер в определенное время, вы можете добавить команду shutdown в планировщик заданий Windows taskschd.msc.

Например, следующее задание планировщика будет ежедневно перезагружать компьютер ночью в 0:00.

задание планировщика для ежедневной перезагрузки компьютера командой shutdown

Либо вы можете создать новое задание планировщика из PowerShell:

$Trigger= New-ScheduledTaskTrigger -At 00:00am -Daily
$User= "NT AUTHORITY\SYSTEM"

$Action= New-ScheduledTaskAction -Execute "shutdown.exe" -Argument "–f –r –t 120"
Register-ScheduledTask -TaskName "RebootEvertyNight_PS" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force

Перезагрузка удаленных компьютеров командой shutdown

Вы можете перезагрузить удаленный компьютер по сети, для этого у вас должен быть к нему сетевой доступ, а учетная запись, из-под которой запускается команда shutdown должна входить в группу локальных администраторов на удаленном компьютере (сервере):

shutdown /r /t 120 /m \\192.168.1.100

shutdown /r //m - перезагрузка удаленного компьютера

Если все указанные условия выполняются, но при выполнении команды shutdown появляется ошибка ”Отказано в доступе (5)”, на удаленном компьютере нужно разрешить удаленный доступ к административным ресурсам (C$, ADMIN$), изменив значение параметра LocalAccountTokenFilterPolicy на 1.

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "LocalAccountTokenFilterPolicy" /t REG_DWORD /d 1 /f

Если для подключения к удаленному компьютеру нужно указать учетные данные пользователя, можно использовать команду:

net use \\192.168.31.10 /u:corp\username
shutdown /s /t 60 /f /m \\192.168.31.10

Если вам необходимо удаленно перезагрузить множество компьютеров, их список можно сохранить в текстовый файл и запустить удаленную перезагрузку всех компьютеров с помощью такого PowerShell скрипта:

$sh_msg = "Ваш компьютер будет автоматически перезагружен через 10 минут. Сохраните свои файлы и закройте запущенные программы"
$sh_delay = 600 # секунд
$computers = gc C:\PS\PC-list.txt
foreach ($comp in $computers)
{
Invoke-Expression "SHUTDOWN.exe /m \\$comp /r /c '$sh_msg' /t $sh_delay"
}

Графический интерфейс команды shutdown

Для тех, кому не комфортно работать в командной строке, есть графический интерфейс для команды shutdown, чтобы его вызвать, наберите:

shutdown /i

shutdown /i - графический интерфейс команды shutdown

Как вы видите, в диалоге удаленного завершения работы вы можете добавить несколько компьютеров, которые нужно перезагрузить/выключить, указать текст уведомления и задать причину выключения для сохранения в журнале Windows.

Перезагрузка и выключение Windows с помощью PowerShell

В PowerShell есть две команды для выключения и перезагрузки компьютера: Restart-Computer и Stop-Computer. Обе команды позволяют выключить или перезагрузить локальный или удаленный компьютер по сети.

powershell команда Restart-Computer

Для перезагрузки Windows выполните:

Restart-Computer -force

Чтобы выключить компьютер:

Stop-Computer

По умолчанию перезагрузка начнется через 5 секунд. Можно увеличить задержку перед перезагрузкой:

Restart-Computer –delay 15

У обоих командлетов есть параметр
–ComputerName
, который позволяет задать список удаленных компьютеров.

Например, чтобы удаленно выключить два сервера Windows:

Stop-Computer -ComputerName "Server01", "Server02"

Можно указать учетные данные администратора для подключения к удаленному хосту:

$Creds = Get-Credential
Restart-Computer -ComputerName $Names -Credential $Creds

Для подключения к удаленным компьютерам используется WMI и DCOM (он должны быть включен и настроен). Если WMI не настроен, при запуске команды появится ошибка:

Restart-Computer : Failed to restart the computer wks-t1122h2 with the following error message: 
Access is denied.
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED).

restart-computer ошибка при удаленной перезагрузке компьютера по сети 0x80070005

Если на удаленном компьютере настроен WinRM (Windows Remote Management), вы можете использовать для подключения WSman вместо WMI:

Restart-Computer -ComputerName wks-t1122h2 -Protocol WSMan

Если на удаленном компьютер есть активные сессии пользователей, при запуске Restart-Computer появится ошибка:

Restart-Computer : Failed to restart the computer wks-t1122h2 with the following error message:
The system shutdown cannot be initiated because there are other users logged on to the computer.

Restart-Computer на удаленном компьютере есть активный пользователь

Для принудительной перезагрузки нужно добавить параметр -Force:

Restart-Computer -ComputerName wks-t1122h2 –Force

С помощью параметра -For можно перезагрузить компьютер и дождаться, когда он будет доступен. Например, вы хотите убедиться, что удаленный компьютер успешно перезагрузится и на нем стартовала служба WinRM, позволяющая подключиться к нему через WS-Management:

Restart-Computer -ComputerName wks-t1122h2 -Wait -For WinRM

Restarting computer wks-t1122h2
Verifying that the computer has been restarted.

Удаленная перезагрузка компьютера из powershell

Можно дождаться запуска службы удаленного рабочего стола (RDP) или любой другой службы Windows:

Restart-Computer -ComputerName wks-t1122h2 -Wait -For TermService

Если нужно одновременно перезагрузить несколько хостов, можно использовать возможности параллельного запуска команд в версии PowerShell 7.x.

Например, вы можете получим список Windows Server в определенном контейнере (Organizational Unit) Active Directory с помощью командлета Get-ADComputer и перезагрузить их одновременно:

$Computers = (Get-ADComputer -Filter 'operatingsystem -like "*Windows server*" -and enabled -eq "true"' -SearchBase "OU=Servers,DC=winitpro,DC=loc").Name
$Computers | ForEach-Object -Parallel {    Restart-Computer -ComputerName $_ -Force} -ThrottleLimit 3

Команда shutdown в Windows является мощным инструментом для управления состоянием компьютера через командную строку. С её помощью можно выполнять выключение или перезагрузку системы, используя различные параметры. Кроме того, команда shutdown поддерживает удалённое управление, позволяя перезагружать или выключать другие компьютеры в сети.

Команда SHUTDOWN используется для перезагрузки / выключения локального и удаленного компьютера с ОС Windows через командную строку.

Системному администратору порой нужно больше возможностей для управления функциями перезагрузки и выключения компьютера, а именно:

  • — перезагрузка удаленного компьютера через локальную сеть;
  • — перезагрузка компьютера из удаленного RDP сеанса;
  • — выключение удаленного компьютера через локальную сеть;
  • — выключение компьютера из удаленного RDP сеанса;
  • — перезагрузка \ выключение компьютера по расписанию.

Команда shutdown позволяет перезагружать / выключать Windows компьютер через командную строку и является очень полезной в арсенале системного администратора.

Синтаксис команды shutdown

Давайте рассмотрим, как пользоваться командой shutdown. Вот какой у неё синтаксис:

shutdown [-i | -l | -s | -r | -a] [-f] [-m \\<компьютер>] [-t xx] [-c «комментарий»] [-d up:xx:yy]

Без аргументов — Вывод справки по использованию (как и -?)

shutdown -i — Отображение графического интерфейса пользователя для удаленного завершения работы.

SHUTDOWN – перезагрузка / выключение Windows через командную строку

shutdown -l — Выход (не совместим с параметром -m)

shutdown -s — Завершение работы компьютера

shutdown -r — Перезагрузка компьютера

shutdown -a — Прекращение завершения работы системы

shutdown -m \\<компьютер> — Удаленный компьютер, на котором выполняется действие

shutdown -t xx — Таймаут завершения работы — xx сек.

shutdown -c «comment» — Комментарий (не более 127 знаков)

shutdown -f — Принудительное завершение приложений без предварительного предупреждения

shutdown -d [u][p]:xx:yy — Код причины завершения работы (u — пользовательский код, p — код запланированного завершения, xx — основной код причины (1 — 255), yy — дополнительный код причины (1 — 65535))

Практические примеры использования shutdown

Таки образом, в зависимости от задач администрирование, команда на перезагрузку \ выключение компьютера может выглядеть следующим образом:

Немедленная перезагрузка через командную строку:

shutdown -r -t 0

Немедленное выключение через командную строку:

shutdown -s -t 0

Перезагрузить удаленный компьютер с ip адресом 192.168.0.85 через 30 секунд с выводом сообщения пользователю:

shutdown –r –m \\192.168.0.85 –t 30 –c “ВАШ КОМПЬЮТЕР БУДЕТ ПЕРЕЗАГРУЖЕН ЧЕРЕЗ 30 СЕКУНД! ПРОСИМ ЗАКРЫТЬ ВСЕ ПРОГРАММЫ С СОХРАНИЕМ ИЗМЕНЕНИЙ.”

Так же стоит учесть, что при попытке перезагрузить удаленный компьютер, вы должны обладать правами администратора на удаленной машине. Если вы залогинены под учетной записью, не умеющей прав на удаленном компьютере, то запустите командную строку от имени пользователя (C:\Windows\System32\cmd.exe \ ПКМ + Shift \ Запуск от имени другого пользователя), который имеет достаточно прав, и выполните команду shutdown.

Several commands are available in Windows that allow you to shutdown or restart a local or remote computer. In this article, we’ll look at how to use the shutdown command and the PowerShell cmdlets Restart-Computer and Stop-Computer to shutdown/restart Windows.

Contents:

  • Using the Shutdown Command on Windows
  • How to Shutdown or Restart a Remote Windows Computer?
  • Restart or Shutdown Windows with PowerShell

Using the Shutdown Command on Windows

The Shutdown.exe is a built-in Windows command line tool that allows you to reboot, shutdown, put your computer to sleep, hibernate, or end a user session. In this guide, we’ll show the basic examples of using the shutdown command in Windows. All commands discussed above are run in the Run dialog box — Win+R ->, in the command prompt (cmd.exe) or PowerShell.

The shutdown command has the following syntax: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/soft] [/fw] [/f] [/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

The shutdown.exe command in Windows

As you can see, the command has quite a lot of options and can be used to shutdown/restart a local or remote computer.

How to shutdown windows from the command prompt

To shutdown Windows, use the shutdown command with the /s key.

shutdown /s

Reboot Windows from the CMD

To reboot your computer, use the /r parameter. After running it, Windows will be gracefully restarted.

shutdown /r

End a User Session

To end the current user session (logoff), run this command

shutdown /l

This command works in the same way as logoff.exe command.

How to hibernate Windows using the shutdown command?

To hibernate your computer, run this command:

shutdown /h

In the hibernate mode, all the contents of memory are written to the hiberfil.sys file on the local disk and the computer goes into sleep mode with reduced power consumption.

Notify logged-in users of an impending reboot or shutdown

You can notify all logged-on Windows users about the upcoming shutdown/reboot of the computer or server by sending a pop-up message to all active sessions. As a rule, this feature is used on RDS servers with several users working on them at the same time in their RDP sessions.

shutdown /r /c “This server will be restarted in 60 seconds.”

Delayed shutdown/reboot of a computer using the timer

You can shutdown or restart the computer with a certain delay (on a timer). Using the /t option, you can specify the time span after which the computer/server will be shutdown or rebooted. Thus you can provide your users some time to save open files and close the apps correctly. It is convenient to use this option together with the notification message. In this example, we inform the users that Windows will be shutdown in 10 minutes (600 seconds).

shutdown /s /t 600 /c "The server will be shutdown in 10 minutes. Save your work!"

A user will be warned about the scheduled shutdown:

You’re about to be signed out

windows shutdown command - You’re about to be signed out. Your Windows will shut down in 10 minutes

If the delay is too long (for example, 60 minutes/3,600 seconds), a pop-up window appears in the lower right corner of the screen:

You’re about to be signed out. Your Windows will shutdown in 100 minutes.

How to stop/cancel/abort system shutdown in Windows

Windows waits 60 seconds by default without doing anything after running shutdown or reboot command.  An administrator can cancel the restart or shutdown of the device by running this command during this time:

shutdown /a

After you cancel the shutdown, you’ll see the following pop-up message in the lower right corner of the screen:

Logoff is cancelled. The scheduled shutdown has been cancelled.

Restart Windows immediately

To shutdown or reboot a computer immediately without waiting for 60 seconds, specify 0 as a value of the /t parameter. For example:

shutdown /r /t 0

The /f key is very important. I use it almost always when shutting down or restarting Windows Server hosts. This attribute allows to force close all running programs and processes without waiting for confirmation from the user (we won’t wait till the users confirm closing all applications on the RDS server since we can never get it).

The next command will restart the computer and automatically run all registered apps after reboot (apps registered in the system using RegisterApplicationRestart API are meant here).

shutdown /g

Create a restart shortcut on Windows Desktop

To make it more convenient for users, you can create a desktop shortcut to restart or shutdown a computer with the required parameters. Such a shortcut may be useful when you need to restart the computer from the RDP session when there are no options to restart or shutdown the computer in the Start menu.

shutdown shortcut

How to restart Windows at a specific time (on schedule)?

If you want your computer or server to restart/shutdown at a specific time, you can add the shutdown command with the parameters to Windows Task Scheduler (taskschd.msc).

For example, this Scheduler task will restart the computer daily at 12 AM.

shedule a shutdown task

Or you can create a new Scheduler task with PowerShell:

$Trigger= New-ScheduledTaskTrigger -At 00:00am -Daily
$User= "NT AUTHORITY\SYSTEM"
$Action= New-ScheduledTaskAction -Execute "shutdown.exe" -Argument "–f –r –t 120"
Register-ScheduledTask -TaskName "RebootEvertyNight_PS" -Trigger $Trigger -User $User -Action $Action -RunLevel Highest –Force

How to Shutdown or Restart a Remote Windows Computer?

You can use the shutdown.exe command to reboot a remote computer. To do this, the remote computer must be accessible over the network, and the account u you are using must be a member of the local Administrators group on the remote computer (server):

shutdown /r /t 120 /m \\192.168.1.210

shutdown remote windows host

If all the conditions described above are met, but when running the shutdown command the error “Access denied (5)” appears, you need to allow remote access to the administrative shares (C$, ADMIN$) on the remote computer by changing the value of LocalAccountTokenFilterPolicy parameter to 1.

reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" /v "LocalAccountTokenFilterPolicy" /t REG_DWORD /d 1 /f

If you need to provide user credentials to connect to a remote computer, you can use the commands:

net use \\192.168.13.111 /u:corp\username
shutdown /s /t 60 /f /m \\192.168.13.111

If you need to restart multiple computers remotely, you can save the list of computers to a text file, and start a remote reboot of all computers using a simple PowerShell script:

$sh_msg = "Your computer will be automatically restarted in 10 minutes. Save your files and close running apps"
$sh_delay = 600 # seconds
$computers = gc C:\PS\PC-list.txt
foreach ($comp in $computers)
{
& 'C:\Windows\System32\SHUTDOWN.exe' "-m \\$comp -r -c $sh_msg -t $sh_delay"
}

Restart multiple computers with a Shutdowm.exe GUI

For those who don’t feel comfortable working in the command prompt, there is a graphical interface for the shutdown.exe command. To call the Remote Shutdown Dialog GUI, use the command:

shutdown /i

remote shutdown GIU dialog

As you can see, you can add multiple computers in the remote shutdown dialog to be rebooted/shutdown, specify the notification text, and specify the reason for the shutdown to be saved in the Windows event log.

Restart or Shutdown Windows with PowerShell

The following two commands are available in Windows PowerShell to shutdown and reboot the computer: Restart-Computer and Stop-Computer. Both commands allow you to shutdown or restart a local or remote computer (over the network).

powershell restart-computer cmdlet

To restart Windows, run:

Restart-Computer -force

To shutdown your computer:

Stop-Computer

By default, the reboot will start in 5 seconds. You can increase the delay before reboot:

Restart-Computer –Delay 60

Both cmdlets have a -ComputerName parameter that allows you to specify a list of remote computers to perform the action on.

For example, to shutdown two Windows servers remotely:

Stop-Computer -ComputerName "mun-srv01", "mun-srv02"

You can specify administrator credentials to connect to a remote host:

$Creds = Get-Credential
Restart-Computer -ComputerName mun-srv01-Credential $Creds

WMI and DCOM are used to connect to remote computers (they must be enabled and configured). If WMI is not configured, the following error will appear when running the command:

Restart-Computer : Failed to restart the computer wks-11222  with the following error message:
Access is denied.
Exception from HRESULT: 0x80070005 (E_ACCESSDENIED).

If WinRM (Windows Remote Management) is enabled on the remote computer, you can use WSman instead of WMI to connect:

Restart-Computer -ComputerName wks-11222 -Protocol WSMan

If there are active user sessions on the remote computer, an error will appear:

Restart-Computer : Failed to restart the computer wks-11222  with the following error message:
The system shutdown cannot be initiated because there are other users logged on to the computer.

Restart-Computer : Failed to restart the computer The system shutdown cannot be initiated because there are other users logged on to the computer

To force a reboot, you need to add the -Force parameter:

Restart-Computer -ComputerName wks-11222 –Force

You can use the -For option to restart your computer and wait until it becomes available. For example, you want to make sure that the remote computer reboots successfully and the WinRM service is started on it, allowing you to connect to it through WS-Management:

Restart-Computer -ComputerName wks-11222 -Wait -For WinRM

Restarting computer wks-11222
Verifying that the computer has been restarted.

check that the remote computer restarted

You can wait for the Remote Desktop Service (RDP) or any other Windows service to start:

Restart-Computer -ComputerName wks-11222 -Wait -For TermService

If you need to restart multiple computers at the same time, you can use the parallel command execution available in PowerShell 7.x (see how to update PowerShell).

For example, you can get a list of Windows Servers hosts in a specific Active Directory container (Organizational Unit) using the Get-ADComputer cmdlet and restart them at the same time:

$Computers = (Get-ADComputer -Filter 'operatingsystem -like "*Windows server*" -and enabled -eq "true"' -SearchBase "OU=Servers,DC=woshub,DC=com").Name
$Computers | ForEach-Object -Parallel {    Restart-Computer -ComputerName $_ -Force} -ThrottleLimit 3

Как выключить компьютер в командной строке, перезагрузить его или перевести в спящий режим

Если по какой-либо причине вам потребовалось выполнить завершение работы через командную строку, возможно — перезагрузить компьютер, перевести его в спящий режим или гибернацию, всё это возможно сделать во всех актуальных версиях Windows.

В этой инструкции подробно о том, как выключить компьютер через командную строку и про выполнение других действий, связанных с перезагрузкой и завершением работы в Windows 11, Windows 10 и других версиях системы. На близкую тему может быть полезным: Как выключить компьютер без мыши.

Команды shutdown.exe — основной способ для завершения работы и перезагрузки

Параметры команды shutdown.exe

В Windows предусмотрена встроенная утилита shutdown.exe, предназначенная для выполнения рассматриваемых в инструкции задач, её можно использовать:

  • В командной строке и PowerShell
  • В диалоговом окне «Выполнить»
  • В BAT-файлах
  • Для создания ярлыка выключения компьютера

Управление утилитой производится с помощью передаваемых ей параметров, полный список которых можно получить, введя команду shutdown /? в командной строке.

Несколько базовых вариантов использования команд shutdown.exe (при вводе команды .exe указывать не обязательно):

  • shutdown /s /t 0 — завершение работы прямо сейчас: время в секундах указывается после параметра t
  • shutdown /r /t 0 — немедленная перезагрузка компьютера
  • shutdown /h /t 0 — перевести компьютер в режим гибернации (при условии, что гибернация не отключена)
  • shutdown /l — выход из системы
  • shutdown /s /hybrid /t 0 — завершение работы с подготовкой к режиму быстрого запуска

Параметры команды shutdown можно указывать как после значка «/», так и после «-», например, следующая команда будет работать так же, как первая в списке:

shutdown -s -t 0

Помимо приведенных примеров команд, вы можете:

  • Изменять значение параметры /t — чтобы установить время до выполнения команды в секундах, например, если вам требуется настроить таймер выключения компьютера
  • При использовании отличного от 0 значения параметра /t добавить параметр /f — чтобы принудительно завершить все открытые программы при выключении

Также рекомендую изучить другие доступные параметры shutdown.exe, использую эту команду с параметром /? — возможно, вы найдёте дополнительные полезные для себя возможности.

Обычно для выключения компьютера с помощью командной строки используется именно shutdown.exe, но есть и иные возможности.

Среди других способов выключить, перезагрузить или перевести в спящий режим (гибернацию) компьютер с помощью командной строки:

Надеюсь, для кого-то из читателей инструкция будет полезной. Если остаются вопросы, вы можете задать их в комментариях ниже, а я постараюсь оперативно ответить.

Shutting down your computer via the Command Prompt is a useful method that can help you perform a clean shutdown without having to use the standard Windows interface. Below are the steps to guide you through the process, along with some variations for advanced shutdown options.

Table of Content

  • 1. Basic Shut Down Command using CMD
  • 2. Time Delay Shut Down using CMD
  • 3. Force Shut Down using CMD
  • 4. Remote Shut down using CMD
  • How to Restart Your System Instead of Shut Down
  • How to Remote Restart the Computer

Shut Down Your PC Using the Command Prompt – 3 Methods

Now, we will be performing 3 different methods to shut down your computer using CMD. Let’s find out:

1. Basic Shut Down Command using CMD

One of the basic and mostly used methods is by running the following command:

Step 1: Open “Run” and type CMD

Hit the Windows + R, type “CMD” or command prompt and hit the Enter button.

cmd

Run

Step 2: Run /s command to Shut Down Your PC

Once you enter the command prompt, type the following command.

SD2

/s

Now, you will see a pop-up for shut down the PC. This will immediate shut down your computer. However, you can also choose to cancel this method using the following command.

How to Cancel the Shut Down

However, you can also choose to cancel this method using the following command:

Shutdown /a

2. Time Delay Shut Down using CMD

You can also schedule to shut down you system using any specific time. Here, we have taken 60 seconds as an example. Let’s follow the steps and command for te same.

Step 1: Open CMD

Go to Run and type CMD. Now, hit the Enter button

open-cmd

CMD

Step 2: Run /s /t Command

If you want your computer to shut down after 1 minute (60 seconds), use the following command:

shutdown /s /t 60

shut-down-3

Timer

Note: Your system will shut down right after 60 seconds. So, ensure to save all your unsaved data to avoid any data loss. However, you can also choose to cancel this method using the following command.

How to Cancel the Time Delay Shut Down

You can also choose to cancel this method using the following command:

Shutdown /a

where, a -> is to abort any scheduled shutdown (within the scheduled time frame).

3. Force Shut Down using CMD

You may also choose to force shut down your system if some applications are blocking the shutdown by following these methods:

Step 1: Open CMD

Go to Run and type CMD. Now, hit the Enter button

open-cmd

Open CMD

Step 2: Run /s /f /t Command

Now, use the following command to force shut down your system.

shutdown /s  /f /t 60

force

Force Shutdown

Note: This command will force down your Windows system within next 60 seconds.

4. Remote Shut down using CMD

If you wish to shut own your system remotely then follow the steps below:

Step 1: Prepare the Remote Computer

Ensure that the remote computer allows remote shutdowns via its firewall settings (the “File and Printer Sharing” feature should be enabled, and the Windows Management Instrumentation (WMI) service should be running).

Step 2: Execute the Command

Now, use this command to shut down your system remotely

shutdown /s /f /t 0 /m \\RemoteComputerName

Here, RemoteComputerName -> remote computer network’s IP

How to Restart Your System Instead of Shut Down

You can also choose to restart your system instead of shutting it down. Let’s understand this how you can perform it in few easy steps.

Step 1: Open Command Prompt

Go to “Run” and type “CMD” and hit the Enter button.

cmd

CMD

Step 2: Run the /r command to Perform the Restart

Now, type the following command to perform an immediate restart of your Windows PC.

shutdown /r /t 0

Here, r -> is the function to restart, and /t 0 -> is to perform an immediate Restart.

How to Remote Restart the Computer

You can also Restart your computer remotely using the following command:

 shutdown /r /f /t 0 /m \\RemoteComputerName

Conclusion

Shutting down your computer using Command Prompt is a quick and efficient way to manage your system, whether you’re performing a local shutdown or managing multiple machines remotely. With simple commands, you can control when and how your computer shuts down or restarts. Using the above commands, you can choose to either shut down immediately, or even restart your machine.

Понравилась статья? Поделить с друзьями:
0 0 голоса
Рейтинг статьи
Подписаться
Уведомить о
guest

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • Https docs microsoft com en us cpp windows latest supported vc redist view msvc 170
  • Что такое windows defender firewall
  • Windows 10 домашняя легкая на русском
  • Чем открыть файл rdp в windows
  • Как оптимизировать windows vista