shutdown (关闭计算机)

嚯嚯 发表于 2020-06-28 14:45
浏览次数:
在手机上阅读

使用shutdown命令可以从命令行关闭Windows XP,Vista,7、8或10计算机。它还具有Windows中不提供的其他功能。

shutdown命令将关闭提示窗口,然后开始关闭Windows。结果与选择开始菜单 → 电源按钮 → 关机的结果相同。

The shutdown command will close the prompt window, and then start shutting down Windows. The result is the same as if you chose Start menu → Power button → Shut down.

查看英文版

目录

1 shutdown 运行系统环境

2 shutdown 语法

3 shutdown 示例

shutdown 运行系统环境

Windows xp

Windows vista

Windows 7

Windows 8

Windows 10

shutdown 语法

Windows 8 语法
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/f]     [/m \\computer][/t 
[/d [p|u:]xx:yy [/c "comment"]]
No args 显示此消息(与/?相同)。
/i 显示GUI(图形用户界面)。
此开关必须是第一个选项。
/l 注销。注意:/ l开关不能与/ m或/ d选项一起使用。
/s 关闭计算机。
/r 完全关闭并重新启动计算机。
/g 完全关闭并重新启动计算机。重新引导系统后,重新启动所有已注册的应用程序。
/a 中止系统关机。但是只能在超时期间使用。
/p 关闭本地计算机,没有超时或警告。可以与/ d和/ f选项一起使用。
/h 休眠本地计算机。可以与/ f选项一起使用。
/hybrid 关闭计算机并为快速启动做准备。
必须与/ s选项一起使用。
/e 记录意外关闭计算机的原因。
/o 转到高级启动选项菜单,然后重新启动计算机。
必须与/ r选项一起使用。
/m \\computer 指定目标计算机。
/t xxx 将关机前的超时时间设置为xxx秒。有效范围是0-315360000(10年),默认值为30。如果超时时间大于0,则隐含/ f参数。
/c "comment" 评论重新启动或关闭的原因。最多允许512个字符。
/f 强制关闭正在运行的应用程序而不会警告用户。如果为/ t参数指定了大于0的值,则意味着/ f参数。
/d [u] [p]:xx:yy

提供重新启动或关闭的原因。

选项:

p - 表示计划重新启动或关闭。
u - 表示原因是用户定义的。

如果未指定p或u,则计划外重新启动或关闭。

原因:

xx - 是主要原因编号(小于256的正整数)。
yy - 是次要原因编号(小于65536的正整数)。

Windows Vista 和 7 语法
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computer][/t xxx][/d 
[p|u:]xx:yy [/c "comment"]]
No args 显示此消息(与-?相同)。
/i 显示GUI(图形用户界面)。
此开关必须是第一个选项。
/l 注销。/ l开关不能与/ m或/ d选项一起使用。
/s 关闭计算机。
/r 关闭并重新启动计算机。
/g 关闭并重新启动计算机。重新引导系统后,重新启动所有已注册的应用程序。
/a 在超时期间中止系统关闭。
/p 关闭本地计算机,没有超时或警告。可以与/ d和/ f选项一起使用。
/h 休眠本地计算机。可以与/ f选项一起使用。
/e 记录意外关闭计算机的原因。
/m \\computer \\ computer指定目标计算机。
/t xxx 将关机前的超时时间设置为xxx秒。有效范围是0-315360000(10年),默认值为30。如果超时时间大于0,则隐含/ f参数。
/c "comment" 评论重新启动或关闭的原因。最多允许512个字符。
/f 强制关闭正在运行的应用程序而不会警告用户。如果为/ t参数指定了大于0的值,则意味着/ f参数。
/d [u] [p]:xx:yy

提供重新启动或关闭的原因。

选项:

p - 表示已计划重新启动或关闭。
u - 指示原因是用户定义的。

如果未指定p或u,则计划外重新启动或关闭。

原因:

xx - 主要原因编号(小于256的正整数)。
yy - 次要原因编号(小于65536的正整数)。

Windows XP 语法
shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
No args 显示此消息(与-?相同)。
-i 显示GUI界面,必须是第一个选项。
-l 注销(不能与-m选项一起使用)。
-s 关闭计算机。
-r 关闭并重新启动计算机。
-a 中止系统关机。
-m \\computername 远程计算机关闭/重新启动/中止。
-t xx 将关机超时设置为xx秒。
-c "comment" 关机评论(最多127个字符)。
-f 强制关闭正在运行的应用程序而不会发出警告。
-d [u] [p]:xx:yy 关闭的原因码。
u - 是用户代码。
p - 是计划的关闭代码。
xx - 是主要原因代码(小于256的正整数)。
yy - 是次要原因代码(小于65536的正整数)。
Windows 8 syntax
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e | /o] [/hybrid] [/f]     [/m \\computer][/t 
[/d [p|u:]xx:yy [/c "comment"]]
No args Display this message (same as /?).
/i Display the GUI (graphical user interface).
This switch must be the first option.
/l Log off. Note: The /l switch cannot be used with /m or /d options.
/s Shutdown the computer.
/r Full shutdown and restart the computer.
/g Full shutdown and restart the computer. After the system is rebooted, restart any registered applications.
/a Abort a system shutdown. But can only be used during the time-out period.
/p Turn off the local computer with no time-out or warning. Can be used with /d and /f options.
/h Hibernate the local computer. Can be used with the /f option.
/hybrid Performs a shutdown of the computer and prepares it for fast startup.
Must be used with /s option.
/e Document the reason for an unexpected shutdown of a computer.
/o Go to the advanced boot options menu and restart the computer.
Must be used with /r option.
/m \\computer Specify the target computer.
/t xxx Set 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.
/c "comment" Comment on the reason for the restart or shutdown. Maximum of 512 characters allowed.
/f Force running applications to close without forewarning users. The /f parameter is implied when a value greater than 0 is specified for the /t parameter.
/d [u] [p]:xx:yy

Provide the reason for the restart or shutdown.

Options:

p - indicates that the restart or shutdown is planned.
u - indicates that the reason is user defined.

If neither p nor u is specified, the restart or shutdown is unplanned.

Reasons:

xx - is the major reason number (positive integer less than 256).
yy - is the minor reason number (positive integer less than 65536).

Windows Vista and 7 syntax
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computer][/t xxx][/d 
[p|u:]xx:yy [/c "comment"]]
No args Display this message (same as -?).
/i Display the GUI (graphical user interface).
This switch must be the first option.
/l Log off. The /l switch cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is rebooted, restart any registered applications.
/a Abort a system shutdown during the time-out period.
/p Turn off the local computer with no time-out or warning. Can be used with /d and /f options.
/h Hibernate the local computer. Can be used with the /f option.
/e Document the reason for an unexpected shutdown of a computer.
/m \\computer \\computer Specify the target computer.
/t xxx Set 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.
/c "comment" Comment on the reason for the restart or shutdown. Maximum of 512 characters allowed.
/f Force running applications to close without forewarning users. The /f parameter is implied when a value greater than 0 is specified for the /t parameter.
/d [u] [p]:xx:yy

Provide the reason for the restart or shutdown.

Options:

p - Indicates that the restart or shutdown is planned.
u - Indicates that the reason is user defined.

If neither p nor u is specified, the restart or shutdown is unplanned.

Reasons:

xx - The major reason number (positive integer less than 256).
yy - The minor reason number (positive integer less than 65536).

Windows XP syntax
shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
No args Display this message (same as -?).
-i Display GUI interface, must be the first option.
-l Log off (cannot be used with -m option).
-s Shutdown the computer.
-r Shutdown and restart the computer.
-a Abort a system shutdown.
-m \\computername Remote computer to shutdown/restart/abort.
-t xx Set timeout for shutdown to xx seconds.
-c "comment" Shutdown comment (maximum of 127 characters).
-f Forces running applications to close without warning.
-d [u] [p]:xx:yy The reason code for the shutdown.
u - is the user code.
p - is a planned shutdown code.
xx - is the major reason code (positive integer less than 256).
yy - is the minor reason code (positive integer less than 65536).

查看英文版

查看中文版

shutdown 示例

shutdown -r -c "Rebooting for latest updates."

此命令将显示Windows系统关闭窗口30秒钟。此窗口将警告用户计算机即将关闭,然后重新启动计算机。

shutdown -i

从命令行或Windows运行行运行,此选项将打开远程关闭对话框窗口。

shutdown /h

在Windows Vista,7或8 中将计算机置于休眠模式。

shutdown /l

在Windows Vista,7或8中立即注销当前用户。

shutdown /s /t 60

60秒后关闭计算机

shutdown /s /m \\PC123 /t 20

20秒后将关闭远程计算机名称“ PC123”。

shutdown /s /t 45
          
shutdown /a

第一个命令在45秒后启动计算机关机。如果第二个命令在关闭超时时间段内执行,则第二个命令将中止关闭操作,在此示例中为45秒。

shutdown -r -c "Rebooting for latest updates."

This command would display a Windows system shutdown window for 30 seconds. This window would warn the user that the computer is going to shut down and then restart the computer.

shutdown -i

Ran from either the command line or from the Windows run line, this option would open the remote shutdown dialog window.

shutdown /h

Place the computer in hibernation mode in Windows Vista, 7, or 8.

shutdown /l

Immediately logs off the current user in Windows Vista, 7, or 8.

shutdown /s /t 60

Shuts down the computer after 60 seconds.

shutdown /s /m \\PC123 /t 20

Will shut down remote computer name "PC123" after 20 seconds.

shutdown /s /t 45
          
shutdown /a

The first command initiates a computer shutdown after 45 seconds. The second command aborts the shutdown if it's executed in the shutdown timeout period, which is 45 seconds in this example.

较早版本的shutdown命令的选项使用连字符(-)而不是正斜杠(/)。

The earlier version of the shutdown command uses a dash (-) instead of forward slash (/) for its options.

查看英文版

查看中文版

其他命令行

systemroot | systeminfo | sys | switches | sc | subst | start | sort | smartdrv | shift | share | sfc | setver | setlocal | set | scandisk | scanreg | schtasks |

如此好文,分享给朋友
发表评论
验证码:
评论列表
共0条