guide · static export
PC · power

Set What Closing the Lid Does on Battery

Lid close, power button and sleep button each have a separate action for AC and battery. Set them with powercfg value indexes and read the active scheme back before you trust it.

by@guidox updated:10/31/26 time:10 min level:Beginner tested on:Windows 11 24H2 works on:Windows 10, Windows 11 tools:Command Prompt, PowerShell
TL;DR

Read the current values with **powercfg /query SCHEME_CURRENT SUB_BUTTONS**, set them with **/setacvalueindex** and **/setdcvalueindex**, then activate the scheme with **/setactive** — without that last call nothing changes.

Before you start

Requirements

  • Admin rights for machine-wide changes
  • A laptop with a lid switch
  • 10 minutes
Step by step

Instructions

01

Read the current lid and button actions

**SUB_BUTTONS** holds the lid, power and sleep button settings, and the GUID under each name is what the value commands need. LIDACTION 0 is do nothing, 1 is sleep, 2 is hibernate, 3 is shut down.

powercfg /getactivescheme
powercfg /query SCHEME_CURRENT SUB_BUTTONS
powercfg /query SCHEME_CURRENT SUB_BUTTONS LIDACTION
02

Set the battery action first

**/setdcvalueindex** is the battery side, **/setacvalueindex** the plugged-in side. Setting only the AC value is the classic mistake that leaves a laptop sleeping on battery.

powercfg /setdcvalueindex SCHEME_CURRENT SUB_BUTTONS LIDACTION 2
powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS LIDACTION 1
powercfg /setactive SCHEME_CURRENT
powercfg /query SCHEME_CURRENT SUB_BUTTONS LIDACTION
03

Give the power button its own job

**PBUTTONACTION** follows the same index rules as the lid. A short press that shuts down cleanly is safer than the default sleep on a laptop used as a desktop.

powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS PBUTTONACTION 3
powercfg /setdcvalueindex SCHEME_CURRENT SUB_BUTTONS PBUTTONACTION 2
powercfg /setactive SCHEME_CURRENT
powercfg /query SCHEME_CURRENT SUB_BUTTONS PBUTTONACTION
04

Check the setting that overrides all of this

**Lid open action** and the modern standby switch in the firmware can ignore the Windows value. **powercfg /a** shows which sleep states the platform actually supports.

powercfg /a
Get-CimInstance -ClassName Win32_ComputerSystem | Select-Object Manufacturer,Model,PCSystemType
powercfg /devicequery lidclose_action
⚠ warningSome vendor tools reset these values at every boot. If the setting reverts, look for a battery or power utility in the startup list.
05

Test both states for real

Close the lid on battery, then on AC. **powercfg /lastwake** and the system event log confirm whether the machine slept, hibernated or stayed awake.

powercfg /lastwake
Get-WinEvent -LogName System -MaxEvents 100 | Where-Object { $_.Id -in 42,107,1 } | Select-Object TimeCreated,Id,ProviderName | Format-Table -AutoSize
06

Restore the defaults in one step

**powercfg /restoredefaultschemes** resets every scheme, which is too broad for one setting. Restoring the two index values you changed is the surgical option.

powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS LIDACTION 1
powercfg /setdcvalueindex SCHEME_CURRENT SUB_BUTTONS LIDACTION 1
powercfg /setactive SCHEME_CURRENT
powercfg /query SCHEME_CURRENT SUB_BUTTONS LIDACTION
Troubleshooting

Common issues

The laptop still sleeps with the lid closed

The DC value was never set, or a vendor utility reapplied it. Query SUB_BUTTONS and check which of the two current values is 1.

Hibernate is not offered as an action

The hibernation file is disabled. Run powercfg /hibernate on and check powercfg /a again.

Close lid appears twice in the query output

One entry is the AC value and one is the battery value. Read the Current AC Power Setting Index and Current DC Power Setting Index lines.

The screen turns off but the machine keeps running

That is the display timeout, not the lid action. Set SUB_VIDEO VIDEOIDLE as well, or use do nothing for the lid and let the screen timeout handle it.

FAQ

Frequently asked

Does this change apply to all users?

Yes. powercfg writes to the active scheme, which is machine-wide, so every account on the laptop gets the same lid behaviour.

Why is there no lid option in Settings?

Windows 11 hides it for some modern standby devices and for accounts managed by policy. The command line still shows and sets the value.

Can I keep the laptop awake with the lid closed?

Set LIDACTION to 0 on both AC and DC. Watch the temperature; a closed lid blocks most of the airflow on thin laptops.

How to undo this

Set LIDACTION and PBUTTONACTION back to 1 on both AC and DC with the same powercfg commands and run powercfg /setactive SCHEME_CURRENT. That restores sleep on lid close and on the power button.

Changelog · 1 entry
  1. 2026-10-31
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress