C# Console

Get Laptop Battery Status using C# Console

Sometimes programs need to know the power status of a computer.  In this application you can learn the status of the computer battery in a simple way.

Before start coding, we must know some words

System.Management Namespace : This namespace contains such as ManagementObjectSearcher, ManagementQuery, ManagementEventWatcher classes that can be used when creating a computer monitor application.

Add System.Management refernce to your project.

Then following code we can query all information about Laptop Battery through Win32_Battery class

 

If you want to get more information about battery, you can look the following code

 

 

 

 

 

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.