PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Program to check power source (Batt. or A/C) of a laptop

I'm looking for a small program that will check for the power source of a laptop computer and return an errorlevel code for use in a batch program for each state. Preferably a com file, or some devcon command I'm overlooking. Can anyone be of service?

Thanks a ton!
James
I don't know how to produce .com (and it seems that info is hard to find now, having to weed through all the COM documentation), so here's an EXE.

The return codes are as follows:
0 to 100: On AC Power, n is the battery percentage remaining
-100 to -1: On DC Power, abs(n) is the battery percentage remaining
-900, -901: Error determining power status

I can see about making it into a com executable if I had some documentation on it.

It will also output to stdio the current power source and battery percentage, so it can be used by itself.

Dan East
Attachments:
PowerStatus.zip (13 KB)
No need for the com, thanks though.