How do I get battery information in windows?

后端 未结 4 1169
清酒与你
清酒与你 2021-01-02 10:57

I have two laptops here. One is running Vista, the other Windows 7. I need to get the specifications on the batteries in both, how do I go about that?

The reason I\

相关标签:
4条回答
  • 2021-01-02 11:16

    Here is a interesting link: http://www.nextofwindows.com/find-out-how-healthy-your-battery-is-on-your-windows-7-laptop/ command described there

    powercfg -energy

    will produce you nice report with many details about battery.

    Hopeit helps :)

    0 讨论(0)
  • 2021-01-02 11:17

    The IOCTL_BATTERY_QUERY_INFORMATION info from DeviceIOControl can tell you the following info:

    Information level

    • BatteryDeviceName
    • BatteryEstimatedTime
    • BatteryGranularityInformation
    • BatteryInformation
    • BatteryManufactureDate
    • BatteryManufactureName
    • BatterySerialNumber
    • BatteryTemperature
    • BatteryUniqueID

    The BatteryInformation structure contains the Chemistry field which describes this info you require.

    • PbAc : Lead Acid
    • LION : Lithium Ion
    • Li-I : Lithium Ion
    • NiCd : Nickel Cadmium
    • NiMH : Nickel Metal Hydride
    • NiZn : Nickel Zinc
    • RAM : Rechargeable Alkaline-Manganese

    There is an example here: http://msdn.microsoft.com/en-us/library/bb204769(v=VS.85).aspx

    0 讨论(0)
  • 2021-01-02 11:20

    If you're using managed code (C# or VB) the Windows API Code Pack has a wrapper class that raises .NET events when power events (going on or off AC, reaching critical battery level etc) happen and exposes properties like estimated battery life remaining. It also includes a whole pile of gory details - the sample shows them.

    0 讨论(0)
  • 2021-01-02 11:31

    You could use WMI and the Win32_Battery class. It has a property called Chemistry that has this information.

    UPDATE:

    Actually, there is also Win32_PortableBattery, which would be more appropriate for a laptop battery. They both inherit from the CIM_Battery class.

    0 讨论(0)
提交回复
热议问题