execute commands on power event


  1. Posts : 71
    DT and LT: Windows 7 and Fedora 14
       #1

    execute commands on power event


    Is there some way to configure Windows 7 to execute commands (such as resolution changing, killing/starting processes and services, etc.) whenever the laptop switches from AC to DC and back? I have been using batterysaver from codeplex.com but it is still in beta and hasn't seen any updates for around 6 months. It is somewhat unreliable and I can't get it to trigger nircmd.exe to lower my resolution when I switch to battery or to raise it when I switch back.

    I think my best bet would be Task Scheduler, but I don't know how to make a power event a trigger. Can anyone help?
      My Computer


  2. Posts : 1
    Win 7 Ent 64 bit
       #2

    Task scheduler could possibly do it. Under the Triggers tab, events could be created. I don't think that plugging and unplugging creates a task event though. Be aware that under conditions there is an AC power setting.
      My Computer


  3. Posts : 71
    DT and LT: Windows 7 and Fedora 14
    Thread Starter
       #3

    Cyberpyr8 said:
    Task scheduler could possibly do it. Under the Triggers tab, events could be created. I don't think that plugging and unplugging creates a task event though. Be aware that under conditions there is an AC power setting.
    I suppose for somethings I could potentially remove them from the startup sequence and read them into task scheduler, but one of the difficult ones would be changing the screen resolution.

    Dell has a utility on the drivers download page that will turn off aero upon switching to battery, but they could have taken it to the extreme by making it also switch the screen resolution to something like 800x600 instead of the native 1280x800.

    I have tried getting nircmd.exe to run through the batterysaver utility that I mentioned and switch the resolution, but I can't get it to work. nircmd.exe is a command line utility that among other things can change the screen resolution. Batterysaver can be configured to execute commands on battery switch (with varying degrees of success) but when I try to add arguments, it does work. I don't understand how they want me to put in the arguments.

    My next step was to create a batch file that would run nircmd.exe with the arguments that I wanted, then compile it into an exe and then add it to the batterysaver profile. That also didn't work.

    I saw that there is a conditions tab, but that will only tell the computer to stop executing something that was already running if it switches to battery power.
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 07:41.
Find Us