Windows 10 shutdown 命令詳解


shutdown 可用於安全關閉 重啓 休眠計算機,注銷當前用戶。

shutdown 通過調用 Windows 操作係統 X:/Windows/System32/shutdown.exe 文件執行。

一般情況下,Windows 操作係統的關機都通過調用 shutdown.exe 實現; 當然,也可終止計劃中的關機操作。

另請參閱: at     PowerCfg

基本用法     詳細用法

shutdown -s -f -t 10
 
shutdown -s -t 300 -c "係統將在 5 分鍾後自動關閉"
			

或根據 U 盤 J:\自動關機.txt 文件是否存在,延遲自動關閉操作係統。

if not exist J:自動關機.txt shutdown -s -t 60 -c "係統將在 1 分鍾後自動關閉"
			

gpedit.msc --> 本地計算機 策略\計算機機配置\Windows 設置\腳本(啓動/關機)\啓動 --> 添加包含以上代碼的 *.BAT 文件。

基本語法

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

 

注意: Windows 7 沒有 /sg /o 及 [/hybrid] [/soft] [/fw] 參數

 

參數 EN 解釋 中文翻譯 備注
沒有參數

Display help.

This is the same as typing /?.

顯示幫助。

這等同鍵入 /?。

/?

Display help.

This is the same as not typing any options.

顯示幫助。

這等同不鍵入任何選項。

/a

Abort a system shutdown.

This can only be used during the time-out period.

Combine with /fw to clear any pending boots to firmware.

中止係統關閉。

這隻能在超時期間使用。

結閤 /fw 能清零任何掛起的固件引導。

/c "comment"

Comment on the reason for the restart or shutdown.

Maximum of 512 characters allowed.

注釋重啓或關機的原因。

最大允許 512 字符。

/d [p|u:]xx:yy

Provide the reason for the restart or shutdown.

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.

xx is the major reason number (positive integer less than 256).

yy is the minor reason number (positive integer less than 65536).

提供重啓或關機的原因。

p 指示已計劃重啓或關機。

u 指示用戶定義的原因。

若 p 和 u 均未指定,則重啓或關機是計劃外的。

xx 是主要原因編號 (小於 256 的正整數)

yy 是次要原因編號 (小於 65536 的正整數)

/e Document the reason for an unexpected shutdown of a computer. 文檔計算機意外關閉原因。
/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.

強製關閉正運行的應用程序,不預警用戶。

當指定 /t 參數大於 0,則 /f 參數被隱含。

/fw Combine with a shutdown option to cause the next boot to go to the firmware user interface. 與關機選項結閤能使下次引導進入固件用戶界麵。
/g

Full shutdown and restart the computer.

After the system is rebooted, restart any registered applications.

完整關閉並重新啓動計算機。

係統重引導後,重啓任何已注冊應用程序。

/h

Hibernate the local computer.

Can be used with the /f option.

休眠本地計算機。

可與 /f 選項一起使用。

/hybrid

Performs a shutdown of the computer and prepares it for fast startup.

Must be used with /s option.

履行計算機的關閉並為快速啓動做準備。

必須與 /s 選項一起使用。

/i

Display the graphical user interface (GUI).

This must be the first option.

顯示 GUI (圖形用戶界麵)。

這必須是第一選項。

/l

Log off.

This cannot be used with /m or /d options.

注銷。

這不能與 /m 或 /d 選項一起使用。

/m \\computer Specify the target computer. 指定目標計算機。
/o

Go to the advanced boot options menu and restart the computer.

Must be used with /r option.

轉到高級引導選項菜單並重啓計算機。

必須與 /r 選項一起使用。

/p

Turn off the local computer with no time-out or warning.

Can be used with /d and /f options.

關閉本地計算機 (沒有超時或警告)。

可與 /d 和 /f 選項一起使用。

/r Full shutdown and restart the computer. 完整關閉並重啓計算機。
/s Shutdown the computer. 關閉計算機。
/sg

Shutdown the computer.

On the next boot, restart any registered applications.

關閉計算機。

在下次引導時,重啓任何已注冊應用程序。

/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.

把關機前的超時時間設為 xxx 秒。

有效範圍 0-315360000 (10 年),默認 30。

如超時時間大於 0,則 /f 參數被隱含。

 

關機原因 E = 預期 U = 意外 P = 計劃內,C = 客戶定義

類型 主要 次要 EN 解釋 中文翻譯
U 0 0 Other (Unplanned) 其他 (計劃外)
E 0 0 Other (Unplanned) 其他 (計劃外)
E P 0 0 Other (Planned) 其他 (計劃內)
U 0 5 Other Failure: System Unresponsive 其他故障: 係統沒有反應
E 1 1 Hardware: Maintenance (Unplanned) 硬件: 維護 (計劃外)
E P 1 1 Hardware: Maintenance (Planned) 硬件: 維護 (計劃內)
E 1 2 Hardware: Installation (Unplanned) 硬件: 安裝 (計劃外)
E P 1 2 Hardware: Installation (Planned) 硬件: 安裝 (計劃內)
E 2 2 Operating System: Recovery (Unplanned) 操作係統: 恢復 (計劃內)
E P 2 2 Operating System: Recovery (Planned) 操作係統: 恢復 (計劃內)
P 2 3 Operating System: Upgrade (Planned) 操作係統: 升級 (計劃內)
E 2 4 Operating System: Reconfiguration (Unplanned) 操作係統: 重新配置 (計劃外)
E P 2 4 Operating System: Reconfiguration (Planned) 操作係統: 重新配置 (計劃內)
P 2 16 Operating System: Service pack (Planned) 操作係統: 服務包 (計劃內)
2 17 Operating System: Hot fix (Unplanned) 操作係統: 熱修補 (計劃外)
P 2 17 Operating System: Hot fix (Planned) 操作係統: 熱修補 (計劃內)
2 18 Operating System: Security fix (Unplanned) 操作係統: 安全修補 (計劃外)
P 2 18 Operating System: Security fix (Planned) 操作係統: 安全修補 (計劃內)
E 4 1 Application: Maintenance (Unplanned) 應用程序: 維護 (計劃外)
E P 4 1 Application: Maintenance (Planned) 應用程序: 維護 (計劃內)
E P 4 2 Application: Installation (Planned) 應用程序: 安裝 (計劃內)
E 4 5 Application: Unresponsive 應用程序: 沒有反應
E 4 6 Application: Unstable 應用程序: 不穩定
U 5 15 System Failure: Stop error 係統故障: 停止錯誤
U 5 19 Security issue (Unplanned) 安全問題 (計劃外)
E 5 19 Security issue (Unplanned) 安全問題 (計劃外)
E P 5 19 Security issue (Planned) 安全問題 (計劃內)
E 5 20 Loss of network connectivity (Unplanned) 網絡連接丟失 (計劃外)
U 6 11 Power Failure: Cord Unplugged 電源故障: 拔下電源綫
U 6 12 Power Failure: Environment 電源故障: 環境
P 7 0 Legacy API shutdown 舊版 API 關機

基本用法

功能 命令 文字解釋 示例 示例解釋
幫助 shutdown 展示幫助信息
shutdown /? 展示幫助信息

 

版權聲明: 本文為獨傢原創稿件,版權歸 樂數軟件 ,未經許可不得轉載。