Guides

How to keep a Windows laptop running with the lid closed

By default, closing a Windows laptop's lid puts it to sleep, and a sleeping PC runs nothing: downloads pause, builds stop, remote sessions drop. You can change that. There are two built-in ways, and one thing people often miss.

Option 1: Power Options (no commands)

  1. Open Control Panel → Hardware and Sound → Power Options, or press Win + R and run powercfg.cpl.
  2. On the left, click Choose what closing the lid does.
  3. Next to When I close the lid, set Plugged in to Do nothing. Leave On battery on Sleep unless you really need it.
  4. Click Save changes.

On recent Windows 11 builds the same choice is also in Settings → System → Power & battery, under the lid and power button controls.

Option 2: one command

In Command Prompt or PowerShell, this sets the plugged-in lid action to "Do nothing":

powercfg /setacvalueindex SCHEME_CURRENT SUB_BUTTONS LIDACTION 0
powercfg /setactive SCHEME_CURRENT

To undo it, run the same two lines with 1 (Sleep) instead of 0. The values are 0 do nothing, 1 sleep, 2 hibernate and 3 shut down.

If the lid option is missing from Power Options on your laptop (some manufacturers hide it), the command still works. To see the current value, run powercfg /qh SCHEME_CURRENT SUB_BUTTONS LIDACTION.

The part people miss: idle sleep

"Do nothing" only changes what the lid does. Windows will still go to sleep after its usual idle time (often 15–30 minutes), lid open or closed. For an overnight job you also need to stop idle sleep: either set Settings → System → Power & battery → sleep timeout to Never, or run powercfg /change standby-timeout-ac 0 (and put it back later, for example with powercfg /change standby-timeout-ac 30).

The risks

What still works either way: choosing Sleep yourself, pressing the power button, and a critically low battery all put the PC to sleep, as Windows intends.