Перезагрузка windows 2000 из командной строки

Windows 2000 (with the Resource Kit installed) and Windows XP (natively) have an actual shutdown command that can be launched from a command prompt — and which, therefore, also can be launched from a shortcut. To see all available options for this command, click Start, click Run, type CMD, and click OK. Then, in the box that appears, type:

SHUTDOWN /?

You can also study the available options in the Microsoft KB 317371, “How to Use the Remote Shutdown Tool to Shut Down and Restart a Computer in Windows 2000.” (The article is basically suitable for Win XP also.)

This command starts a 30-second countdown for a shutdown or restart, which permits you to abort it (with a shutdown -a command). It you want the command to execute, use the -t flag, which lets you set the time lapse in seconds. The examples below use a 1-second delay.

For a shortcut to RESTART Windows XP:
SHUTDOWN -r -t 01

For a shortcut to SHUT DOWN Windows XP:
SHUTDOWN -s -t 01

Unfortunately — especially on Windows XP — this option only shuts down Windows. It does not shut down your computer, at least on most hardware. For that, on Win XP (and for most Win 2000 users also), I recommend the freeware utility Shutdown.exe (not to be confused with the Windows utility by the same name) by MS-MVP Andrej Budja. I’ve seen several shutdown utilities recommended, but this is the only one that I’ve seen actually shut down Windows XP and then powerdown the computer behind it. For more information on the tool, see here. After you place this utility in the root folder of C:, the commands for a shutdown, restart, or hibernate (respectively), each without a time delay, would be shutdown -u -t 0 for shutdown, shutdown -r -t 0 for restart, and shutdown -h -t 0 for hibernate.

By , on November 28, 2009 at 9:55 am, under 1. No Comments

Post a comment or leave a trackback: Trackback URL.

WINDOWS SHUTDOWN & RESTART CENTER
SHORTCUTS TO SHUTDOWN &
RESTART WINDOWS 2000 & XP

Last updated January 1, 2006
Click here to refresh this page & its menu bar.

You can create desktop shortcuts to shutdown or restart Windows, or go into standy or hibernate mode, with a single click. You can put these shortcuts anyplace you like — on the desktop itself, the Quick Launch bar, your Start Menu — wherever.

To make a new shortcut, right-click on an empty part of the desktop (or inside a folder). Select New, then Shortcut. A “wizard” will pop up to guide you through the rest of the process. You will have to provide a command line, and then a name. The name can be anything you want.

Shutdown & Restart Shortcuts for Windows XP & Windows 2000

Windows 2000 (with the Resource Kit installed) and Windows XP (natively) have an actual shutdown command that can be launched from a command prompt — and which, therefore, also can be launched from a shortcut. To see all available options for this command, click Start, click Run, type CMD, and click OK. Then, in the box that appears, type:

SHUTDOWN /?

You can also study the available options in the Microsoft KB 317371, “How to Use the Remote Shutdown Tool to Shut Down and Restart a Computer in Windows 2000.” (The article is basically suitable for Win XP also.)

This command starts a 30-second countdown for a shutdown or restart, which permits you to abort it (with a shutdown -a command). It you want the command to execute, use the -t flag, which lets you set the time lapse in seconds. The examples below use a 1-second delay.

For a shortcut to RESTART Windows XP:
SHUTDOWN -r -t 01

For a shortcut to SHUT DOWN Windows XP:
SHUTDOWN -s -t 01

Unfortunately — especially on Windows XP — this option only shuts down Windows. It does not shut down your computer, at least on most hardware. For that, on Win XP (and for most Win 2000 users also), I recommend the freeware utility Shutdown.exe (not to be confused with the Windows utility by the same name) by MS-MVP Andrej Budja. I’ve seen several shutdown utilities recommended, but this is the only one that I’ve seen actually shut down Windows XP and then powerdown the computer behind it. For more information on the tool, see here. After you place this utility in the root folder of C:, the commands for a shutdown, restart, or hibernate (respectively), each without a time delay, would be shutdown -u -t 0 for shutdown, shutdown -r -t 0 for restart, and shutdown -h -t 0 for hibernate.

Using the TSShutDn Utility

If you don’t want to use a third-party utility, you may be able to get by with a lesser known utility in Windows 2000 and Windows XP. The native commandline tool tsshutdn.exe was originally designed for shutting down servers, not work stations. It was introduced in Windows 2000, and retained in Windows XP. See MSKB 320188, “How to Use the TSSHUTDN Command to Shut Down a Terminal Server in Windows 2000 Terminal Services,” and MSKB 243202, “Windows 2000 Terminal Services Session Management Tools.” From a command prompt, type tsshutdn /? for a list of its subcommands and syntax. A command line of C:\WINDOWS\SYSTEM32\TSSHUTDN.EXE 0 /DELAY:0 /POWERDOWN will powerdown most Windows 2000 and Windows XP computers, though some (according to correspondent “perris,” who first turned me onto this native utility) will get an error message 1702.

Customize Your Computer’s Power Switch

Another solution for Windows XP users involves using the power switch on your computer — but only after you’ve set it to shutdown Windows first! If you poweroff your computer without shutting down Windows (and letting your applications save their data and close, if necessary), you invite a whole lot of serious problems! The correct way to do this is: After a fresh reboot of the computer, in the Windows XP Control Panel click Power Options. Click the Advanced tab. In the Power Buttons section, under “When I press the power button on my computer,” select “Shutdown.” (If this is not visible on your Advanced tab, then your computer does not have the hardware capability to do this job correctly, or the capability is disabled in CMOS.) Click Apply. This sets your computer so that when you press the hardware power button it will first do a proper shutdown of Windows, and then poweroff the computer.

Shutdown — Утилита для выключения, перезагрузки, logoff…

Эта утилита выполняет простые функции выключения компьютера, но делает это хорошо для любых версий Windows — 9X, NT, 2000 и XP, 7, 8, 10.

Работает как из командной строки так и из системного трея. 
Параметры командной строки могут быть такими:

   /shutdown — выключить компьютер
   /logoff      — выйти текущему пользователю из системы
   /poweroff  — выключить питание (выключает и XP!)
   /reboot      — выполнить перезагрузку 

Для перечисленных выше ключей может быть указан второй — /terminate, в этом случае форсируется закрытие зависших задач.

В Windows 2000/XP и выше работают и следующие два параметра:

   /suspend   — приостановить работу
   /hibernate — выполнить гибернацию (выключение с сохранением образа памяти на жестком диске для последующего быстрого восстановления состояния при включении.

Примеры использования Shutdown:

shutdown.exe /shutdown /force 
shutdown.exe /hibernate

Загрузить программу Shutdown.zip (140 Кбайт)


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

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

Формат командной строки:

SHUTDOWN.EXE [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\компьютер][/t xxx][/d [p|u]xx:yy [/c «комментарий»]]

Если в командной строке не заданы параметры, или задан параметр /? — то на экран выдается краткая справка по использованию команды.

Вместо синтаксиса /ключ допускается использование -ключ:

SHUTDOWN.EXE [-i | -l | -s | -r | -g | -a | -p | -h | -e] [-f] [-m \\компьютер][-t xxx][-d [p|u]xx:yy [-c «комментарий»]]

Параметры командной строки:

/i — Отображение графического интерфейса пользователя. Этот параметр должен быть первым.
/l — Завершение сеанса. Этот параметр нельзя использовать с параметрами /m или /d.
/s — Завершение работы компьютера.
/r — Завершение работы и перезагрузка компьютера.
/g — Завершение работы и перезагрузка компьютера. После перезапуска системы, запуск всех зарегистрированных приложений.
/a — Отмена завершения работы системы. Этот параметр можно использовать только в период ожидания.
/p — Немедленное отключение локального компьютера без предупреждения. Можно использовать с параметрами /d и /f.
/h — Переключение локального компьютера в режим гибернации. Можно использовать с параметром /f.
/e — Указание причины непредвиденного завершения работы компьютера.
/o — Переход в меню дополнительных параметров загрузки и перезагрузка компьютера. Данный параметр допустим для Windows 8 и более поздних версий. Необходимо использовать в с параметром /r.
/m \\компьютер — Имя или IP-адрес конечного компьютера.
/t xxx — Задание задержки в xxx секунд перед завершением работы компьютера. Допустимый диапазон: 0-315360000 (10 лет); значение по умолчанию: 30 секунд. Если период таймаута больше 0, применяется параметр /f.
/c «комментарий» — Комментарий с причиной перезапуска или завершения работы. Наибольшая длина — 512 знаков.
/f — Принудительное закрытие запущенных приложений без предупреждения пользователей. Параметр /f используется, если для параметра /t задано значение больше 0.
/d [p|u:]xx:yy Необходимо указать причину для перезагрузки или выключения. «p» означает запланированную перезагрузку или завершение работы. «u» означает, что причина определяется пользователем. Если не задано ни «p», ни «u», перезагрузка или завершение работы являются незапланированными. xx является основным кодом причины (целое положительное число, меньшее 256). yy является вспомогательным кодом причины (целое положительное число, меньшее 65536).

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

Примеры использования команды SHUTDOWN:

shutdown или shutdown /? — отобразить справку по использованию команды.

shutdown /s — выключить питание компьютера через 30 секунд. Пользователю будет выдано предупреждение о запланированном выключении.

shutdown /s /t 0 — выключить питание компьютера немедленно.

shutdown /s /t 60 /m \\COMP7 — выключить питание компьютера COMP7 через 60 секунд.

shutdown /s /t 60 /m \\192.168.0.1 — выключить питание компьютера с IP-адресом 192.168.0.1 через 60 секунд. При необходимости, пользователь с правами администратора, может отменить процесс выключения командой shutdown -a

shutdown /h — перевести компьютер в режим гибернации. При выполнении команды, вся информация из оперативной памяти (процессы, программы, данные) сохраняются в специальном файле hyberfil.sys, находящемся в корневом каталоге системного диска и выполняется обычное выключение питания. При следующем включении компьютера, диспетчер загрузки Windows ( BOOTMGR ) выполнит восстановление состояния системы из файла hyberfil.sys. Режим перевода в гибернацию должен быть включен для данного компьютера, например командой powercfg /H on или с помощью оснастки «Электропитание» панели управления Windows. Также, необходимо учитывать, что для реализации данного режима потребуется наличие большого объема свободного места на жестком диске под копию оперативной памяти.

shutdown /l — завершить сеанс текущего пользователя. Команда завершения сеанса может быть выполнена только на локальном компьютере и только для текущего пользователя. Аналогично выполнению команды logoff без параметров.

shutdown /r — выполнить перезагрузку локального компьютера. По умолчанию, перезагрузка выполнится через 30 секунд, если не задан параметр /t

shutdown /r /o /t 0 — выполнить перезагрузку локального компьютера немедленно (t 0 , с возможностью выбора дополнительных опций (/o. После перезагрузки на экран выводится меню выбора действий, с помощью которого можно либо продолжить обычную загрузку, либо выбрать дополнительные режимы для диагностики и восстановления системы. Параметр /o допустим для операционных систем Windows 8 и более поздних.

shutdown /r /m \\192.168.0.1 — выполнить перезагрузку компьютера с IP-адресом 192.168.0.1.

shutdown /g — выполнить перезагрузку с восстановлением выполнения приложений, зарегистрированных с использованием функции API RegisterApplicationRestart . Обычно используется при обновлении системы, когда в процессе установки необходима перезагрузка с продолжением процесса инсталляции.

shutdown /r /c «Плановая перезагрузка» /d P:12:555 — выполнить перезагрузку компьютера с отображением сообщения «Плановая перезагрузка» и записью в системный журнал причины — «Запланированная», основной код — «12» (0x0B), дополнительный код — «555» (0x022b).

shutdown /i — запуск графической среды утилиты shutdown.exe. На экран выводится «Диалог удаленного завершения работы».

Диалог удаленного завершения работы

Диалог удаленного завершения работы

Для выполнения операции выключения, перезагрузки или завершения сеанса пользователя, нужно ввести имя или IP- адрес компьютера с использованием кнопки «Добавить», выбрать желаемое действие, причину и заполнить поле «Комментарий», текст из которого будет отображаться в информационном сообщении о запланированном действии. Для большинства причин, поле комментария является обязательным, и без его заполнения кнопка «OK» будет неактивной.

В Windows 7 и более поздних, удаленное выключение или перезагрузка с использованием команды shutdown, может завершаться ошибкой ”Отказано в доступе (5)” даже при наличии прав администратора и при разрешении принудительного удаленного завершения работы в локальных групповых политиках. Кроме того, при обращении к скрытым административным ресурсам C$, ADMIN$… и т.п. удаленного компьютера запрашивается имя пользователя и пароль, но подключение завершается отказом в доступе. Проблема решается выводом компьютера из домашней сети и добавлением (изменением) параметра реестра, в раздел:

hklm\Software\Microsoft\Windows\CurrentVersion\Policies\System
необходимо добавить параметр LocalAccountTokenFilterPolicy, принимающий значение dword:00000001

После занесения данных в реестр, для применения изменений требуется перезагрузка.

В дополнение:

Управление электропитанием в командной строке Windows — команда POWERCFG

W10
RUNDLL32 powrprof.dll, SetSuspendState Sleep
Sleep
 

W7
SHUTDOWN /s /t 60 /c «Shutdown in progress, leave the vicinity immediately»
Shutdown in 60 seconds, with warning message
Use -m \\remote_computer to shutdown/logoff a remote computer.

W7
SHUTDOWN /p
Immediate shutdown without warning

W7
SHUTDOWN /l
Logoff

W7
SHUTDOWN /h
Hibernate (or sleep if hibernate is disabled)

XP Pro
NLTEST /server:localhost /shutdown:»Shutting down, just for fun» 60
Shutdown in 1 minute, displaying the «reason» in a popup
Use a remote server name instead of localhost to shutdown that remote server.

XP Pro
NLTEST /server:localhost /shutdown_abort
Abort the shutdown in progress
Use a remote server name instead of localhost to abort a shutdown in progress on that remote server.

XP Pro
WMIC OS Where Primary=TRUE Call Shutdown
Immediate shutdown
Use WMIC’s /NODE switch to shutdown a remote computer.

XP Pro
WMIC OS Where Primary=TRUE Call Reboot
Immediate reboot
Use WMIC’s /NODE switch to reboot a remote computer.

XP Pro
WMIC OS Where Primary=TRUE Call Win32Shutdown 4
Forced logoff (0+4)
n can be any of the following numbers:

0	Logoff
1	Shutdown
2	Reboot
+4	Force
8	Poweroff

XP Pro
WMIC OS Where Primary=TRUE Call Win32Shutdown 12
Forced poweroff (8+4)

XP
SHUTDOWN -r -t 10
Delayed reboot
Reboot after a 10 seconds delay.
Can be stopped during those 10 seconds using SHUTDOWN -a

XP
SHUTDOWN -s -t 01
Delayed shutdown
Shutdown after a 1 second delay, NO poweroff.

XP
SHUTDOWN -i
Interactive use with GUI
Can be used to shutdown multiple computers.

TS
LOGOFF 16 /SERVER:termserv1
Logoff
Logoff session 16 on Terminal Server TERMSERV1.
Use the QUERY USER command to find out which session ID belongs to whom.
Find more Terminal Server commands.

TS
TSSHUTDN 45 /SERVER:termserv1 /POWERDOWN /DELAY:20 /V
Delayed poweroff
Notify all users on Terminal Server TERMSERV1, logoff all Terminal Server sessions after 45 seconds, wait another 20 seconds, and then shut down Terminal Server TERMSERV1 and power off.
See my Terminal Server Commands page for the exact syntax.

W2K (5)
DEVCON Reboot
Reboot
Requires Microsoft’s DEVCON utility

W2K
RUNDLL32 PowrProf.dll, SetSuspendState
Activate suspend state
 

W2K
RUNDLL32 USER32.DLL,LockWorkStation
Lock
Credits: Steven Clements (posted on alt.msdos.batch.nt)

NT+ (1)
PSSHUTDOWN -d -t 0
Suspend
Uses PSSHUTDOWN.EXE from SysInternals’ PS Tools.

NT+ (1)
PSSHUTDOWN \\mynt4srv -K -F -T 20
Delayed poweroff
Poweroff \\mynt4srv after a 20 seconds delay.
Can be aborted using PSSHUTDOWN \\mynt4srv -A
Uses PSSHUTDOWN.EXE from SysInternals’ PS Tools.

NT+ (1)
PSSHUTDOWN \\myw2ksrv -O -F -T 0
Logoff
Immediately logoff console user on \\myw2ksrv
Uses PSSHUTDOWN.EXE from SysInternals’ PS Tools

NT4+RK
W2K+RK
SHUTDOWN /L /R /T:0 /Y
Reboot
Immediate shutdown & reboot

NT4+RK
W2K+RK
SHUTDOWN /L /T:10 /Y /C
Delayed shutdown
Shutdown in 10 seconds, close without saving.
Can be stopped during those 10 seconds using SHUTDOWN /A

NT4
See Reboot NT on my Solutions found in alt.msdos.batch page
Reboot
Reboot immediately

NT4
RUNDLL32 USER32.DLL,ExitWindowsEx
RUNDLL32 USER32.DLL,ExitWindowsEx
Logoff
Most systems require the command to be called twice before logging off

Win98/ME
RUNDLL32 SHELL32.DLL,SHExitWindowsEx n
Any
n can be any of the following numbers: (4):

0	Logoff
1	Shutdown
2	Reboot
+4	Force
8	Poweroff (if supported by the hardware)

Win98/ME
RUNONCE.EXE -q
Reboot (4)
 

Win98
RUNDLL32 KRNL386.EXE,exitkernel
Poweroff
Poweroff for ATX boards only, otherwise normal shutdown (3)

Win9*
RUNDLL USER.EXE,ExitWindows
Shutdown (2)
 

Win9*
RUNDLL USER.EXE,ExitWindowsExec
See Remarks
Win95: various results, usualy fast shutdown (and lock PC), sometimes restart Windows, sometimes reboot.
Win98: Restart Windows, sometimes reboot.

Win9*
RUNDLL SHELL.DLL,RestartDialog
Restart dialog
«System Settings Changed, Do you want to restart your computer now?» dialog

Win31*
ECHO G=FFFF:0000| DEBUG
Task Manager popup
And sometimes reboot

DOS
ECHO G=FFFF:0000| DEBUG
Reboot
Warm boot, sometimes cold boot.
May not work with «exotic» memory managers, like Quarterdeck’s QEMM or DesqView; in that case, use RESET.COM instead.

PowerShell
Restart-Computer -Force
Reboot
Immediately reboot the local computer.

PowerShell
Restart-Computer -ComputerName «remotepc» -Confirm -Force
Reboot
Reboot remote computer «remotepc», prompt for confirmation on local computer first.

PowerShell
Stop-Computer -Force
Shutdown
Immediately shutdown the local computer.

PowerShell
Stop-Computer -ComputerName «remotepc» -Confirm -Force
Shutdown
Shutdown remote computer «remotepc», prompt for confirmation on local computer first.

PowerShell
Stop-Process -ProcessName *
Blue Screen
Kills all running processes immediately without confirmation, resulting in a «Blue Screen Of Death».

KiXtart
$RC = SHUTDOWN( «\\server«, «Shutting down…», 10, 1, 0 )
Delayed shutdown
Shutdown \\server in 10 seconds, with message, close without saving, no reboot

KiXtart
$RC = SHUTDOWN( «\\server«, «», 0, 1, 1 )
Reboot
Immediately shutdown & reboot \\server, without a message

KiXtart
$RC = LOGOFF( 1 )
Logoff
Forcing applications to close.
Use 0 instead of 1 if you don’t want to force applications to close

KiXtart
$RC = SetSystemState( 0 )
Lock
Requires KiXtart 4.51 or later

KiXtart
$RC = SetSystemState( 1 )
Standby
Requires KiXtart 4.51 or later

KiXtart
$RC = SetSystemState( 2 )
Hibernate
Requires KiXtart 4.51 or later.

KiXtart
$RC = SetSystemState( 3, 0 )
Poweroff
Power off with prompt to close applications.
Use SetSystemState( 3, 1 ) to close applications without prompting.
Requires KiXtart 4.51 or later

Perl
InitiateSystemShutdown( $sComputer, $sMessage, $uTimeoutSecs, $bForce, $bReboot )
 
General syntax (ActivePerl for Windows only)

Perl
InitiateSystemShutdown( «», «», 0, 1, 1 )
Reboot
Immediately reboot without message, force applications to close without saving data

Perl
InitiateSystemShutdown( «», «Going down…», 10, 0, 1 )
Delayed reboot
Reboot after 10 seconds, with message and without forcing applications to close

Perl
InitiateSystemShutdown( «10.0.1.16», «Sorry», 5, 1, 0 )
Delayed shutdown
Shutdown of remote computer after 5 seconds, with message and forced closing of applications

Regina Rexx
RC = W32SysShutdown( how [,force] )
 
General syntax (Regina Rexx for Windows with W32Funcs only).
how can be either Reboot, Logoff, Poweroff or Shutdown.
force can be either Force or Noforce.

Regina Rexx
RC = W32SysShutdown( «P», «F» )
Poweroff
Immediately shutdown and poweroff, forced closing of application

Regina Rexx
RC = W32SysShutdown( «L», «N» )
Logoff
Logoff, prompt for saving unsaved data

WSH
[1] Set OpSysSet = GetObject(«winmgmts:{(Shutdown)}//./root/cimv2»).ExecQuery(«select * from Win32_OperatingSystem where Primary=true»)
[2]
[3]
for each OpSys in OpSysSet
[4]     OpSys.Reboot( )
[5]
next
Reboot
Requires WMI.
Remove [line numbers].
(by Alex K. Angelopoulos)

WSH
Replace line 4 in the script above with this one:
[4]    OpSys.Shutdown( )
to shut down the PC instead of rebooting it.
Shutdown
But no poweroff.

 
See my WSH page for examples on how to reboot or shut down remote computers too.

WSH
[1] Const EWX_LOGOFF   = 0
[2]
[3]
Set wmi = GetObject(«winmgmts:{(Shutdown)}»)
[4] Set objSet = wmi.InstancesOf(«Win32_OperatingSystem»)
[5]
[6]
For Each obj in objSet
[7]     Set os = obj
[8]     Exit For
[9] Next
[10]
[11]
os.Win32Shutdown EWX_LOGOFF
Logoff
Requires WMI.
Remove [line numbers].
(Posted by Michael Harris on microsoft.public.scripting.vbscript)

 
My Logoff.vbs combines this code with that of the reboot and shutdown commands, and allows logoff of remote computers as well.

WSH
Set objShell = CreateObject( «Shell.Application» )
Shell.ShutdownWindows
Open the Shutdown dialog
Based on the Advanced Stuff listing on groups.msn.com/windowsscript/.

OS/2
START /PM SHUTDOWN && EXIT
Shutdown
Will still stop and ask for confirmation if a non-PM application is active

OS/2
SETBOOT /B
Reboot
Unconditional shutdown & reboot from default Boot Manager entry.
(Mailed by Rick Curry)

OS/2
SETBOOT /IBD:C:
Reboot
Unconditional shutdown & reboot from C: drive

OS/2
SETBOOT /IBA:nonsense
Shutdown
Unconditional shutdown & failing reboot.
Needs Boot Manager installed.
Will reboot, no questions asked, and then stop if nonsense is an invalid Boot Manager menu entry (which, in this case, is exactly what we want).

OS/2
LOGOFF
Logoff
Both LAN Server client and Peer

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

0 комментариев
Старые
Новые Популярные
Межтекстовые Отзывы
Посмотреть все комментарии
  • En windows thin pc x86 697681
  • Как удалить приложения которые не удаляются windows 10
  • Как проверить dpi мыши windows 11
  • Не найден необходимый драйвер носителя при установке windows 10 с флешки на ssd
  • Как сделать так чтобы некоторые программы не запускались при старте windows 10