變更 [開始] 功能表開啟/關閉按鈕 的登錄值 PowerButtonAction使用者HKCU\Software\Policies\Microsoft\Windows\Explorer

原則 ID
PowerButtonAction
適用範圍
使用者設定
支援的作業系統
Windows Server 2008 R2 與 Windows 7
來源
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (版本 1.0)
類別
[開始] 功能表和工作列

登錄

PowerButtonAction

REG_DWORD使用者
啟用時的值
取決於選項值
元素
選擇下列其中一個動作
選項
項目儲存的值
關機2
睡眠16
登出1
鎖定512
重新啟動4
切換使用者256
休眠64
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Explorer]

; 選項 (只使用其中一個)
; 關機
"PowerButtonAction"=dword:00000002
; 睡眠
"PowerButtonAction"=dword:00000010
; 登出
"PowerButtonAction"=dword:00000001
; 鎖定
"PowerButtonAction"=dword:00000200
; 重新啟動
"PowerButtonAction"=dword:00000004
; 切換使用者
"PowerButtonAction"=dword:00000100
; 休眠
"PowerButtonAction"=dword:00000040
CMD
:: 選項 (只使用其中一個)

:: 關機
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 2 /f
:: 睡眠
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 16 /f
:: 登出
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 1 /f
:: 鎖定
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 512 /f
:: 重新啟動
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 4 /f
:: 切換使用者
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 256 /f
:: 休眠
reg add "HKCU\Software\Policies\Microsoft\Windows\Explorer" /v "PowerButtonAction" /t REG_DWORD /d 64 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Force | Out-Null

# 選項 (只使用其中一個)
# 關機
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 2 -Force | Out-Null
# 睡眠
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 16 -Force | Out-Null
# 登出
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 1 -Force | Out-Null
# 鎖定
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 512 -Force | Out-Null
# 重新啟動
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 4 -Force | Out-Null
# 切換使用者
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 256 -Force | Out-Null
# 休眠
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Explorer' -Name 'PowerButtonAction' -PropertyType DWord -Value 64 -Force | Out-Null