Changing Power Scheme settings through Registry instead of Control Panel in Windows 7

ori picture ori · May 23, 2012 · Viewed 51k times · Source

I'd like to change the settings of a power scheme (say, go to sleep after 45 minutes instead of 30) through the registry, rather than the control panel, in Windows 7. I'd also like to turn hot keys off the same way.

Any suggestions how I do it?

Answer

CaptainKeyboarder picture CaptainKeyboarder · Feb 27, 2014

I know this is an old question, but in case anyone has it again in the future, here's an example of code I got to work when I hit a similar issue.

Mind, I agree with the previous assessment of using and abstracted API, but in case this helps anyone:

::Set the 'Power Management' to Balanced
powercfg -SETACTIVE 381b4222-f694-41f0-9685-ff5bb260df2e

::Set the unplugged settings to 'Never'
powercfg.exe -change -monitor-timeout-dc 0
powercfg.exe -change -standby-timeout-dc 0
powercfg.exe -change -hibernate-timeout-dc 0

::Set the plugged in settings to 'Never'
powercfg.exe -change -monitor-timeout-ac 0
powercfg.exe -change -standby-timeout-ac 0
powercfg.exe -change -hibernate-timeout-ac 0

::Set the 'Dim Timeout' to Never
powercfg -SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 7516b95f-f776-4464-8c53-06167f40cc99 17aaa29b-8b43-4b94-aafe-35f64daaf1ee 0
powercfg -SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 7516b95f-f776-4464-8c53-06167f40cc99 17aaa29b-8b43-4b94-aafe-35f64daaf1ee 0

Source of Reference: http://ss64.com/nt/powercfg.html