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)
- Open Control Panel → Hardware and Sound → Power Options, or press
Win + Rand runpowercfg.cpl. - On the left, click Choose what closing the lid does.
- Next to When I close the lid, set Plugged in to Do nothing. Leave On battery on Sleep unless you really need it.
- 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_CURRENTTo 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
- Heat. A closed laptop cools less well. Keep it on a hard, open surface, and never put a running laptop in a bag. Windows gives apps no reliable temperature reading, so nothing can warn you.
- Forgetting. Both settings stay on until you change them back. The classic mistake is closing the lid, putting the laptop in a bag, and finding it hot and drained hours later.
- Battery. A busy laptop can drain even on a weak charger. On battery, "Do nothing" keeps it running until the battery is critically low.
- Some laptops have firmware that sleeps on lid close anyway. Try a short test first.
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.