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

51,640

Solution 1

I suspect this would be non-trivial due to the complexity of the power management architecture (schemes etc) & its always better to go through an abstracted API rather than fiddling with the underlying configuration data.

If you dont want to use the API there is the powercfg command line tool.

Solution 2

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

Share:
51,640
ori
Author by

ori

Updated on May 23, 2021

Comments

  • ori
    ori almost 3 years

    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?