Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.


Windows 7: execute commands on power event


04 Sep 2010   #1

DT and LT: Windows 7 and Fedora 14
 
 
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 System SpecsSystem Spec
.

04 Sep 2010   #2

Win 7 Ent 64 bit
 
 

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 System SpecsSystem Spec
04 Sep 2010   #3

DT and LT: Windows 7 and Fedora 14
 
 

Quote   Quote: Originally Posted by Cyberpyr8 View Post
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 System SpecsSystem Spec
.


Reply

 execute commands on power event




Thread Tools




Our Sites

Site Links

About Us

Find 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 11:14 PM.
Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App
  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33