shutdown 是 Windows 內建定時關機/重啟/休眠工具,支援本地/遠程操作。CMD 不區分大小寫,批註用 ::。
shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f] [/m \\computer] [/t xxx] [/d [p|u:]xx:yy [/c "comment"]]
| 參數 | 動作 |
|---|---|
/l | 註銷 (不可與 /m /d 同用) |
/s | 關機 |
/r | 重啟 |
/g | 重啟並重新啟動已註冊應用 (需應用支援) |
/a | 中止關機 (僅超時期間有效) |
/p | 立即關機,無超時警告 |
/h | 休眠 |
/t xxx | 超時秒數 0-315360000 (10 年),預設 30 |
/f | 強制關閉應用程式 |
/m \\computer | 遠端操作目標電腦 |
/c "msg" | 關機提示訊息 |
/d p:xx:yy | 記錄計劃性關機原因碼 |
/d u:xx:yy | 記錄非計劃性關機原因碼 |
at 24:00 shutdown -s (需啟用 Task Scheduler 服務)shutdown -s -t 7200 (120 分鐘後)shutdown -ashutdown -i 彈出對話框at 12:45 shutdown -s -t 20 (12:45 關機,倒數 20 秒)at 8:10 rundll32 powrprof.dll,SetSuspendStatepowercfg -h off (刪除 hiberfil.sys 節省空間)powercfg -h on善用 shutdown 實現無人值守維護窗口、節能排程。