選取睡眠按鈕動作 (使用電池) 的登錄值 DCSettingIndex電腦HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB

原則 ID
DCSleepButtonAction_2
適用範圍
電腦設定
支援的作業系統
至少需要 Windows Vista
來源
Administrative Templates (.admx) for Windows 11 2026 Update (26H2) (版本 1.0)
類別
系統 › 電源管理 › 按鈕設定

登錄

DCSettingIndex

REG_DWORD電腦
啟用時的值
取決於選項值
元素
睡眠按鈕動作
選項
項目儲存的值
不執行動作0
睡眠1
休眠2
關機3
以 .reg · CMD · PowerShell 套用
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB]

; 選項 (只使用其中一個)
; 不執行動作
"DCSettingIndex"=dword:00000000
; 睡眠
"DCSettingIndex"=dword:00000001
; 休眠
"DCSettingIndex"=dword:00000002
; 關機
"DCSettingIndex"=dword:00000003
CMD
:: 選項 (只使用其中一個)

:: 不執行動作
reg add "HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB" /v "DCSettingIndex" /t REG_DWORD /d 0 /f
:: 睡眠
reg add "HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB" /v "DCSettingIndex" /t REG_DWORD /d 1 /f
:: 休眠
reg add "HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB" /v "DCSettingIndex" /t REG_DWORD /d 2 /f
:: 關機
reg add "HKLM\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB" /v "DCSettingIndex" /t REG_DWORD /d 3 /f
PowerShell
# 共通: 建立機碼
New-Item -Path 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB' -Force | Out-Null

# 選項 (只使用其中一個)
# 不執行動作
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB' -Name 'DCSettingIndex' -PropertyType DWord -Value 0 -Force | Out-Null
# 睡眠
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB' -Name 'DCSettingIndex' -PropertyType DWord -Value 1 -Force | Out-Null
# 休眠
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB' -Name 'DCSettingIndex' -PropertyType DWord -Value 2 -Force | Out-Null
# 關機
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Power\PowerSettings\96996BC0-AD50-47EC-923B-6F41874DD9EB' -Name 'DCSettingIndex' -PropertyType DWord -Value 3 -Force | Out-Null