Hi. I'm trying to use a script to control my power options since XP doesn't give you an intuitive way to change CPU Frequency options. Here's my script so far:
meh = `cmd.exe /C POWERCFG.EXE /QUERY Portable/Laptop`
puts ""
puts meh
case input
when 1 then system('cmd.exe /C POWERCFG.EXE /CHANGE Portable/Laptop /processor-throttle-ac NONE')
when 2 then system('cmd.exe /C POWERCFG.EXE /CHANGE Portable/Laptop /processor-throttle-ac ADAPTIVE')
when 3 then `cmd.exe /C POWERCFG.EXE /CHANGE Portable/Laptop /processor-throttle-ac CONSTANT`
end
The problem is that the changes simply don't take place. If I run the same commands directly into a cmd.exe prompt, they work. It's very strange, but nothing works after the initial powercfg query. I feel like I'm missing something incredibly obvious.
How can I get the above script to run correctly?
Update: C:\shoe>ruby freq.rb
Field Description Value
----------------- -----
Name Portable/Laptop
Numerical ID 1
Turn off monitor (AC) After 15 mins
Turn off monitor (DC) After 5 mins
Turn off hard disks (AC) After 30 mins
Turn off hard disks (DC) After 5 mins
System standby (AC) After 20 mins
System standby (DC) After 5 mins
System hibernates (AC) Not Supported
System hibernates (DC) Not Supported
Processor Throttle (AC) ADAPTIVE
Processor Throttle (DC) ADAPTIVE
Enter a number to switch portable/laptop profile to that mode.
1 - None (HIGHEST FREQUENCY MODE)
2 - Adaptive (SPEEDSTEP)
3 - Constant (LOWEST FREQUENCY MODE)
#SCRIPT IS CANCELED HERE. I've already tested the methods to change powercfg options, and they work, but they only apply to Ruby's instance of powercfg.
C:\shoe>powercfg /QUERY 1 /NUMERICAL
Field Description Value
----------------- -----
Name Portable/Laptop
Numerical ID 1
Turn off monitor (AC) After 15 mins
Turn off monitor (DC) After 5 mins
Turn off hard disks (AC) After 30 mins
Turn off hard disks (DC) After 5 mins
System standby (AC) After 20 mins
System standby (DC) After 5 mins
System hibernates (AC) Not Supported
System hibernates (DC) Not Supported
Processor Throttle (AC) CONSTANT
Processor Throttle (DC) ADAPTIVE