Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

關機還是休眠?一條 PowerShell 指令查詢 Win10 上次關機類型

編輯:Win10 系統基礎知識

Windows 8 起引入「快速啟動」(混合關機),結合休眠與關機機制縮短開機時間。但開始選單僅顯示「關機」,無法分辨實際模式。透過 PowerShell 可查詢上一次開機類型代碼,精確掌握關機方式。

查詢方法

  1. 在 Cortana 搜尋列輸入 PowerShell,按 Enter 開啟。
  2. 輸入以下指令並執行:
Get-WinEvent -ProviderName Microsoft-Windows-Kernel-boot -MaxEvents 10 | Where-Object {$_.id -like "27"};
英文版 Windows 10 請改用:Get-WinEvent -ProviderName Microsoft-Windows-Kernel-boot -MaxEvents 10 | Where-Object {$_.message -like "The boot type*"};

代碼對照表

  • 0x0 - 完全關機
  • 0x1 - 混合關機(快速啟動)
  • 0x2 - 休眠

執行結果會顯示最近 10 次開機事件的 ID 為 27 的記錄,對照上表即可得知每次採用的關機模式。

Copyright © Windows教程網 All Rights Reserved