Monday, October 16, 2023

Disabling critical battery action

 I have an old laptop with an almost dead battery, which I always use tethered to a power source, mostly as a media device connected to my TV. Occasionally, I need to move it, and if it's open, Windows realizes that the battery is very weak and decides to hibernate, as that's the default critical battery action. This can become very frustrating. The good news is that you can easily address this issue using Windows' powercfg command.

If you try to change that action using Control Panel -> Power Options -> Advanced power settings -> Battery -> Critical battery action, you'll notice that you can only choose between "Sleep", "Hibernate", and "Shut down". There's no "Do nothing" option as there is in the "Low battery action."


Fortunately, Windows offers a powerful utility called powercfg that enables you to manage various power settings. In this case, we will use powercfg to prevent the laptop from hibernating on low battery. You'll need a PowerShell or Command Prompt (elevation is not needed), and you can use the following two commands to set "Do nothing" for both "On battery" and "Plugged in":

Please note the difference in the setdcvalueindex and setacvalueindex parameters. The "0" at the end means "Do nothing".


I've tested this on Windows 10 but it should work on any Windows version.

No comments: