shutdownshutdown

使你能够一次关闭或重新启动一台或多台本地或远程计算机。Enables you to shut down or restart local or remote computers, one at a time.

语法Syntax

shutdown [/i | /l | /s | /r | /a | /p | /h | /e] [/f] [/m \\<computername>] [/t <XXX>] [/d [p|u:]<XX>:<YY> [/c "comment"]]

参数Parameters

参数Parameter 说明Description
/i/i 显示 " 远程关机 " 框。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.
/r/r 关闭后重新启动计算机。Restarts the computer after shutdown.
/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.
/e/e 使您能够记录目标计算机上意外关闭的原因。Enables you to document the reason for the unexpected shutdown on the target computer.
/f/f 强制关闭正在运行的应用程序,而不发出警告用户。Forces running applications to close without warning users.
警告: 使用 /f 选项可能会导致丢失未保存的数据。Caution: Using the /f option might result in loss of unsaved data.
一样 \\<computername>/m \\<computername> 指定目标计算机。Specifies the target computer. 不能与 /l 选项一起使用。Can't be used with the /l option.
/t <n>/t <n> 将超时期限或延迟设置为在重新启动或关机之前的 n 秒。Sets the time-out period or delay to n seconds before a restart or shutdown. 这会导致在本地控制台上显示警告。This causes a warning to display on the local console. 可以指定0-600 秒。You can specify 0-600 seconds. 如果不使用 /t,则默认情况下超时期限为30秒。If you don't use /t, the time-out period is 30 seconds, by default.
/d [p | u:]<XX>:<YY>/d [p | u:]<XX>:<YY> 列出系统重新启动或关机的原因。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
    如果未指定 pu ,则重新启动或关机是未计划的。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).
  • YY 指定次要原因号 (整数小于 65536) 。YY Specifies the minor reason number (a positive integer, less than 65536).
/c <comment>/c <comment> 让你可以对关闭原因作详细注释。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.

  • 用户必须是 Administrators 组的成员,才能批注本地或远程管理的计算机意外关闭。Users must be members of the Administrators group to annotate an unexpected shutdown of a local or remotely administered computer. 如果目标计算机已加入域,则 Domain Admins 组的成员也许能够执行此过程。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:

  • 如果希望一次关闭多台计算机,则可以使用脚本为每台计算机调用 " 关闭 ",也可以使用 shutdown /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:

shutdown /r /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1

若要用与上一个示例相同的参数重新启动远程计算机 myremoteserver ,请键入:To restart the remote computer myremoteserver with the same parameters as the previous example, type:

shutdown /r /m \\myremoteserver /t 60 /c "Reconfiguring myapp.exe" /f /d p:4:1

其他参考Additional References