Question

I'm trying to write two batch files that will allow me to switch the Power Scheme (Control Panel -> Power Options -> Power Schemes Tab) from Home/Office Desk to Portable/Laptop and back. My operating system is Windows XP SP3.

My reason for doing this is because I want to disable SpeedStep when I'm playing games on my laptop (i.e. put it on the Home/Office Desk scheme) and enable SpeedStep otherwise (back to Portable/Laptop). Windows XP turns turns off dynamic switching in Home/Office Desk mode. I'd like to be able to do this programatically to save myself some time everytime I want to play a game.

Any thoughts on how to modify the power settings using a simple batch file? Python and Ruby scripting is also an option but isn't preferred.

Was it helpful?

Solution

C:>%windir%\system32\powercfg.exe /?

    /SETACTIVE, /S  Makes the power scheme with the specified name active.
Examples:
    POWERCFG /SETACTIVE scheme

OTHER TIPS

@echo off
setlocal EnableDelayedExpansion

echo Available power schemes:
echo/

set i=0
set "options="
for /F "tokens=2,3 delims=:()" %%a in ('powercfg /L') do if "%%b" neq "" (
   set /A i+=1
   set "options=!options!!i!"
   echo !i!. %%b
   set "scheme[!i!]=%%a"
)

echo/
choice /C %options% /N /M "Select desired scheme: "
powercfg /S !scheme[%errorlevel%]!
echo/
echo Power scheme set

Perhaps you need to adjust the "tokens=2,3 delims=:()" FOR options; this code was written for Windows 8.1 Spanish version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top