Only some windows shell commands work via ruby?
        Posted  
        
            by Sanarothe
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sanarothe
        
        
        
        Published on 2010-04-12T12:25:07Z
        Indexed on 
            2010/04/12
            12:33 UTC
        
        
        Read the original article
        Hit count: 412
        
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?
© Stack Overflow or respective owner