I am working on a kiosk type system right now – really, it is a kiosk.   So we want the user to feel like the system is running all of the time, and the power settings to turn off the display hinder that.

The settings are readily available in the control panel, but that isn't very convenient.   I want to control them from batch file which would help remove the human error problem.   My first attempt was to start the power control panel from the command line – at least this reminded me that I needed to change the settings…    To start the power control panel applet, run “control /name microsoft.poweroptions”.

But it would be much better if I could change the settings.   They must be in the registry, but I wasn't able to figure those out (see note at bottom).   Better though is the use of powercfg.exe which allows the settings to be changed from the command line.

Running “powercfg /?” will show the many command line options, but I only need to change settings for the current power scheme.   So running “powercfg /? Change” will show that the following are configurable:

  • ·        monitor-timeout-ac
  • ·        monitor-timeout-dc
  • ·        disk-timeout-ac
  • ·        disk-timeout-dc
  • ·        standby-timeout-ac
  • ·        standby-timeout-dc
  • ·        hibernate-timeout-ac
  • ·        hibernate-timeout-dc

I want to disable these which can be done by setting the timeout to zero (0):

powercfg /change monitor-timeout-ac 0

 

Doing that over and over in a batch file seems cumbersome, so let’s read a list from a file and change the settings:

@echo off
set PowerListFile=powerlist.txt

FOR /F %%i in (%PowerListFile%) DO (
               call :DisablePowerSetting %%i
)
goto :EOF

:DisablePowerSetting
               powercfg /change %1 0
goto :EOF

 

And powerlist.txt might contain:

monitor-timeout-ac
monitor-timeout-dc
disk-timeout-ac
disk-timeout-dc
standby-timeout-ac
standby-timeout-dc
hibernate-timeout-ac
hibernate-timeout-dc

NOTE: I was able to find a few registry settings for values not controlled by powercfg.  These are:

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\17aaa29b-8b43-4b94-aafe-35f64daaf1ee\DefaultPowerSchemeValues\381b4222-f694-41f0-9685-ff5bb260df2e]
     "DcSettingIndex"=dword:00000000
     "AcSettingIndex"=dword:00000000

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\17aaa29b-8b43-4b94-aafe-35f64daaf1ee\DefaultPowerSchemeValues\8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c]
     "DcSettingIndex"=dword:00000000
     "AcSettingIndex"=dword:00000000

 

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Power\PowerSettings\7516b95f-f776-4464-8c53-06167f40cc99\17aaa29b-8b43-4b94-aafe-35f64daaf1ee\DefaultPowerSchemeValues\a1841308-3541-4fab-bc81-f71556f20b4a]
     "DcSettingIndex"=dword:00000000
     "AcSettingIndex"=dword:00000000

The GUIDs make this very messy.   But, on my system, these control the Balance power scheme settings for Sleep, Hard Disk Shutdown and a second setting for turning off the display.