ghacks Technology News

Run something if battery is (dis)connected

It sometimes happens by accident that the power cable gets disconnected when you work with your notebook. It does not have to be by accident though, maybe you want to use the notebook in a different location without having to save everything and boot again. The problem that arises when a power cable gets disconnected is that the notebook loses battery power which is a huge problem if the battery was not loaded fully.

Battery Run is a little command line utility that checks if a power cable is connected. Once it gets disconnected it starts a user defined action and another one when the cable gets connected again. You could for instance play a sound if the power cable gets disconnected to notify you or a software that would reduce power consumption.

Usage is straightforward. Download and unpack the file on your hard drive. Use the command batteryrun load-program-when-disconnected load-program-when connected. For example: batteryrun disconnected.wav connected.wav

Batteryrun will play the disconnected.wav file when the power cable gets disconnected and the connected.wav file when it gets connected again. A icon should appear in the system tray if everything was setup correctly.

Enjoyed the article?: Then sign-up for our free newsletter or RSS feed to kick off your day with the latest technology news and tips, or share the article with your friends and contacts on Facebook or Twitter.

Related Articles:

Vista Battery Saver Beta
Test your notebooks battery
Extend Windows Vista Battery Live for Notebooks
Windows Vista Notebook Battery Saver
Display Notebook Battery Status



About the Author:Martin Brinkmann is a journalist from Germany who founded Ghacks Technology News Back in 2005. He is passionate about all things tech and knows the Internet and computers like the back of his hand. You can follow Martin on Facebook or Twitter.

Author: , Wednesday January 23, 2008 -
Tags:, , , , ,


Responses so far:

  1. yair says:

    just what i needed, thanks!

  2. duryodhan says:

    All of the notebooks I have used, you can see a noticeable difference in screen brightness as soon as the ac power is connected and a sound is also played. A light on the laptop also turns off.

  3. yair says:

    i use an old laptop to run a 3 year unattended time-lapse photography. it is connected to UPS.
    if i have severe power failure i need to run a notification when the ups fails and the battery kicks in.
    i use gcal command line utility to send an sms.
    anyways this is exactly what indeed…

Leave a Reply   Follow Ghacks   Subscribe To Comment Rss

Subscribe without commenting

© 2005-2012 Ghacks.net. All Rights Reserved. Privacy Policy - About Us