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
freelancer91

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
Cyberpyr8

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
freelancer91

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





Similar help and support threads
Thread Forum
Batch Files - Create a Menu to Execute Commands
How to Use a Batch File to Create a Command Prompt Menu to Execute Commands This tutorial shows the process one goes through when creating a batch file that opens a command prompt menu allowing you to launch commands, programs and more. I will only be executing programs in this tutorial,...
Tutorials
BSOD on Shutdown Event Log = Kernel-Processor-Power. Event ID: 6
Hi all, I've just built an AcerPower F6 desktop to Win 7 Pro 32 every shutdown it shows BSOD and promptly restarts. Event log is showing me the following for a critical event at the same time the shutdown occurs (The date on the log is from a week ago but this happens every shutdown which...
BSOD Help and Support
Start Command Prompt and automatically execute a few commands
I am learning a programming language, and I frequently use command prompt to compile source codes, but every time I start command prompt I need to manually cd to the correct directory, and then I like to run cls to keep the window clean. I have looked around, but I'm not sure how to phrase a google...
Software
Execute copy-cut-paste commands via voice
I am looking for a way where I can execute the windows commands "ctrl-c", "ctrl-v" and "ctrl-x" by simply saying "copy", "paste" and "cut" into the microphone of my headset. So simple and verbally uncomplicated instructions, but need to be issued immediately without several seconds delay. First...
Software
Event 1001 BugCheck Event 41 Kernel-Power Event 4 k57nd60a
Alright, started getting the 1001 BugCheck crash with Event 41 Kernel-Power BSOD a few times not long ago, widely spaced out incidents (it will lock up, make a very weird repetitive noise through my stereo speakers and will also get black and white bars across the screen before the blue screen...
BSOD Help and Support
automatically execute commands when switching to DC
Is there any way I can tell windows to execute various commands when I pull the power adapter from my laptop? For example, I could tell it to close certain background programs that drain battery life or to change the resolution automatically to save power.......
Performance & Maintenance

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 10:23.

Twitter Facebook Google+



Windows 7 Forums

Seven Forums Android App Seven Forums IOS App