1. Home
  2. Windows Tips
  3. Get alerts when your laptop battery is low or full

Get Alerts When Your Laptop Battery Is Low Or Full [Windows]

I had a spot of trouble with my laptop these past few days. Now that it’s been repaired, I have to keep a very close eye on how much the battery is charged. Before this happened, all I ever needed to care about was if my battery was plugged in and charging. Since it hadn’t bothered me in the past (and this is about 4 years worth of past), I really had zero ideas as to how to monitor battery percentage levels without expanding too much effort. There was the obvious risk that I’d just forget to check how much charge my battery had left, or how full it was. Fortunately, both problems were solved by using a script, and some built-in battery checks that Windows has. You can use both to get on-screen and audio alerts for when your battery has charged up to a certain level and it works for when you want to set a limit to the minimum or maximum charge.

Low Battery Percentage Alerts

Go to Control Panel>Hardware and Sound>Power Options>Edit Plan Settings and select a power plan to edit. Scroll down the list of manageable options until you see the Battery option. Here you can enable an audio alert for when the battery reaches Critical level and for when it is low. The great thing is you can select just how much those levels are. Levels can be set for both when your system is plugged in and/or on battery.

windows low battery level

High Battery Percentage Alert

This one is kind of tricky and there are two ways you can get this done. The first method has you revisiting the Power Plans. You can set the Critical battery level to whatever percentage of battery charge you wanted to be alerted to. You will need to set the Critical battery action to ‘do nothing’ if you’re monitoring high battery charge levels otherwise when your battery is say 99% charged, the action might trigger the hibernate state. It’s obvious why this isn’t the greatest method.

The second method is the use of a super simple script. Paste the script (given below) into Notepad, and save it as Battery.vbs (set the save as dialogue to save as ‘all files). Save this file to your desktop and create a shortcut for it. Paste the shortcut in your Start-up folder if you need it to run automatically. Alternatively, if you don’t need it to run each time you boot your system, keep the file (and its shortcut) out of the Start-up folder and run it when you need to.

set oLocator = CreateObject("WbemScripting.SWbemLocator")
set oServices = oLocator.ConnectServer(".","root\wmi")
set oResults = oServices.ExecQuery("select * from batteryfullchargedcapacity")
for each oResult in oResults
iFull = oResult.FullChargedCapacity
next

while (1)
set oResults = oServices.ExecQuery("select * from batterystatus")
for each oResult in oResults
iRemaining = oResult.RemainingCapacity
bCharging = oResult.Charging
next
iPercent = ((iRemaining / iFull) * 100) mod 100
if bCharging and (iPercent > 95) Then msgbox "Battery is at " & iPercent & "%",vbInformation, "Battery monitor"
wscript.sleep 30000 ' 5 minutes
wend

This script alerts you when the battery has charged to 96%,  and when it falls to 5%. You can edit the line if bCharging and (iPercent > 95) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor” and replace the value in (iPercent > 95) to whatever value suits you.

Script via
The script has been working great for me so far and here’s hoping it does what you need it to as well.

Battery Limiter

For anyone who doesn’t want to work with a script and would prefer an app instead, give Battery Limiter a try. It works great.  Battery Limiter is a free little Windows app that basically does the same thing as the script i.e. it alerts you when your battery is 96% charged. It does however do two additional things; instead of just giving you an on-screen alert, it sounds an alaram. It’s also incredibly easy to customize the maximum charge percentage threshold.

Battery Limiter

If you’re battery is charged above 96% (the default setting), a beeping alarm will sound. Unplug your laptop to make the sound stop. To customize at what charge percentage the app alerts you, simply use the slider on the app’s interface to change it.

Battery Limiter-widget

The app is small and absolutely brilliant. It beats using a script simply because of how easy it is to customize the alert but also because the alert itself doesn’t interrupt what you’re working on. Be warned though, this app will prevent your laptop from sleeping.

Install Battery Limiter

61 Comments

  1. Hi, How can modify the script, so that it notifies me when the LOW battery is at 20% ?

  2. Hi, I’m getting now Invalid namespace error. How to resolve this. can someone help

  3. Here’s one with low battery warning also, popup messages have different exclamation sounds, some times my battery gets dry, because windows doesn’t give a warning, do not forget to change text encoding to ANSI :

    set oLocator = CreateObject(“WbemScripting.SWbemLocator”)
    set oServices = oLocator.ConnectServer(“.”,”root\wmi”)
    set oResults = oServices.ExecQuery(“select * from batteryfullchargedcapacity”)
    for each oResult in oResults
    iFull = oResult.FullChargedCapacity
    next

    while (1)
    set oResults = oServices.ExecQuery(“select * from batterystatus”)
    for each oResult in oResults
    iRemaining = oResult.RemainingCapacity
    bCharging = oResult.Charging
    next
    iPercent = ((iRemaining / iFull) * 100) mod 100
    if bCharging and (iPercent > 92) Then msgbox “Battery is almost full – ” & iPercent & “%”,vbInformation, “Battery guard”
    if Not bCharging and (iPercent < 15) Then msgbox "Battery is low – " & iPercent & "%",vbExclamation, "Battery guard"
    wscript.sleep 30000 ' 5 minutes
    wend

  4. Can you please help me with the Start up folder. I didn’t understand that point.

  5. Hi everyone… I don’t know how active this place is during the 2020 quarantine, just discovered this script and loving it; I really don’t know how scripts work so I was wondering if there’s a way to take it one step further and design a script that not only notifies you but also stops the battery from charging anymore after it reaches 90% and then restarts the charging automatically when the battery drops to a certain level like 30%?? that would be awesome!

  6. Can u plzzz send me the script for the low bartery alert? I did not understand it very well, so I’ll be glad if u cud just send me the low battery script on “Hspnsr43@gmail.com” THANKS YOU 🙂
    Hopefully, I’ll get ur email soon

    • Can u please also send me the script for the low battery alert? I cannot understand the instructions

    • set oLocator = CreateObject(“WbemScripting.SWbemLocator”)
      set oServices = oLocator.ConnectServer(“.”,”root\wmi”)
      set oResults = oServices.ExecQuery(“select * from batteryfullchargedcapacity”)
      for each oResult in oResults
      iFull = oResult.FullChargedCapacity
      next

      while (1)
      set oResults = oServices.ExecQuery(“select * from batterystatus”)
      for each oResult in oResults
      iRemaining = oResult.RemainingCapacity
      bCharging = oResult.Charging
      next
      iPercent = ((iRemaining / iFull) * 100) mod 100
      if bCharging and (iPercent > 20) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”
      wscript.sleep 30000 ‘ 5 minutes
      wend

  7. hi i want to make an arduino prgram that a lamp will turn on if mylap top battery is full

  8. can someone please help, the Pop up indicator of “96% battery” is opening behind the pages i am working on, what to do so that the pop up opens on the top layer of other pagers?

  9. plz help me out i have installed it but i have install on desktop now i want remove it how should i remove it because its continuos giving messages battery is full ..
    actually message should come once only how to solve this problem otherwise tell how to remove this application????

    • Modify the While secton as below to exit the loop after the alert message:

      while (1)
      set oResults = oServices.ExecQuery(“select * from batterystatus”)
      for each oResult in oResults
      iRemaining = oResult.RemainingCapacity
      bCharging = oResult.Charging
      next
      iPercent = ((iRemaining / iFull) * 100) mod 100
      if bCharging and (iPercent > 95) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”

      Exit While
      End If

      wscript.sleep 30000 ‘ 5 minutes
      wend

  10. Hello Fatima

    You wrote an awesome script and I installed it, sadly enough it didn’t do what I wanted it to do. How do you remove it from your laptop? When I just remove the main .vbs file my battery still won’t charge to 100%, even if I change the numbers in the script. Als because of that my charging LED is always showing that my battery is charging wich is a bit anoying. How can I solve this?

    Greetings
    Jules

  11. worst ever, never follow this extremely misguiding advice, ruined my battery & computer’s charging system

    • Right. There should be a script to undo this thing. Now I keep getting popups.

  12. Hi,
    I created the script and placed it in the start up folder (windows key + R -> shell:startup). However, when the battery was fully charged the script was not working, thus, no alert was coming up about the 96% charge of battery. Then, I decided to delete the script (the original one and the shortcut in the start up folder) and installed battery limiter, which works perfectly. Here’s the strange thing: when I deleted the script file, then it started to function properly, although it would pop up 4 dialg boxes. How do I ”undo” this?

  13. Hey guys,
    I want to get the notification when the battery is completely full (100%), but when I change the percentage in the script from >95 to >99 it doesn’t notify anymore (it works fine for >98). At first I thought it is because when the battery is full it won’t be charging anymore, so I changed “if bCharging and (iPercent > 95)” to “if (iPercent > 95)”. That also didn’t do it.
    What seems to be the problem here? Does this script only work for percentages below 100%?

    • set oLocator = CreateObject(“WbemScripting.SWbemLocator”)
      set oServices = oLocator.ConnectServer(“.”,”root\wmi”)
      set oResults = oServices.ExecQuery(“select * from batteryfullchargedcapacity”)
      for each oResult in oResults
      iFull = oResult.FullChargedCapacity
      next

      while (1)
      set oResults = oServices.ExecQuery(“select * from batterystatus”)
      for each oResult in oResults
      iRemaining = oResult.RemainingCapacity
      bCharging = oResult.Charging
      next
      iPercent = ((iRemaining / iFull) * 100) mod 100
      if bCharging and (iPercent > 99) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”
      wscript.sleep 30000 ‘ 5 minutes
      wend

      Try adding this code

  14. you can also add a voice message with the notification by using the below modified script

    set oLocator = CreateObject(“WbemScripting.SWbemLocator”)
    set oServices = oLocator.ConnectServer(“.”,”rootwmi”)
    set oResults = oServices.ExecQuery(“select * from batteryfullchargedcapacity”)
    dim speechobject
    set speechobject=createobject(“sapi.spvoice”)
    for each oResult in oResults
    iFull = oResult.FullChargedCapacity
    next

    while (1)
    set oResults = oServices.ExecQuery(“select * from batterystatus”)
    for each oResult in oResults
    iRemaining = oResult.RemainingCapacity
    bCharging = oResult.Charging
    next
    iPercent = ((iRemaining / iFull) * 100) mod 100
    if bCharging and (iPercent > 95) Then
    msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”
    speechobject.speak “Please unplug the charger as battery level has reached 95%”
    End If
    wscript.sleep 30000 ‘ 5 minutes
    wend

    • Awesome. Going to try this out.
      I would also like to know if i can set an audio alert for the critical level at 13% Charge level, so that i get a lead time to plug the charger or save my work and shut down before blackout.

    • I found a funny thing.
      “ (inverted comma) should be replace with” and ‘ should be replace with ‘. Those characters are look alike but not same. Those are giving Error: invalid character Code: 800A0408

  15. how do i disable the script without restarting my pc after manually enabling/clicking the script?

  16. based on what was mentioned, does it mean that the battery limiter
    app won’t let me sleep my computer even from clicking the sleep button?

  17. Hi, could any one of you help me please? I have added the script and it works fine but it’s annoying. so I deleted the .vbs file but still the alert message box pops up. Any solution to get rid of this completely?

    • Remove the shortcut u pasted in the Startup folder.

      As Willam said earlier “the shortcut here by tapping (WIN) + R on your keyboard. Then Type shell:startup <<< This is the startup folder."

  18. Just wanted to throw it out there for all of you, Battery Limiter just got upgraded to version 1.0.3 and now you can also set “low” battery charge limit. Really great little tool.

  19. Hi… I am using the same script but it doesn’t work for me, no message pop up when the battery is 96 or even 100% which results in delayed unplugging the charger… Plz help!!! I use dell inspiron 5110 i5 windows 10pro

    • Try manually running the script when you next start your system (simply execute the script file) and see if that works. If it does, there’s a problem with the script not being added correctly to the start folder.

    • Task manager show the script is running in background process… so i guess no need to run manually, its already running, may be firewall blocking to popup, but i need to know how to check firewall blockings…????

  20. Hi Fatima! Thanks for this helpful tool. However, my little cousin messed with it and now 4 message boxes pop up at the same time and it is really annoying. How do I undo this? PLease help. Thank you

  21. Hi, I like it. But I have a little problem. It’s work perfectly but It suck when playing game. I mean it minimize the game and notification comes up. I totally hate this situation. Can you designed it to play a WAV sound like “low battery level”. I mean when reach to 95% or whatever percentage it has to play a nice sound. You know what am I mean… right?

  22. Hi Guys,

    Assalamu Alaikum ,

    This might take some time to read .But Please Don’t ignore

    I am not getting any notification ever since I changed

    if bCharging and (iPercent > 95) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”

    to

    if bCharging and (iPercent > 100) Then msgbox “Battery is at ” & iPercent & “%”,vbInformation, “Battery monitor”

    After I typed and saved as mentioned above windows did not get loaded (I could not reach the Desktop of my windows 7)

    Then it asked for system complete checkup which never completed

    so I took the battery out and plugged in back in then searched in my phone how to restart without startup being initialized

    I found that during windows booting start you have to keep pressing “f12” key … to skip “Windows startup”

    My Question is

    How do I make it notify me about the full charge

    Note: I had copied the same script when I first checked if it really works (It worked first time) but after the above mentioned change has been make …Even that is not working

    I am going to buy a new battery guys .So please Reply.

    I am waiting for you valuable feedback

    Thank you

    With Regards
    Hassan Rashid

    • You see, the script is set to warn you whenever the battery is above the set percentage, that’s why the “>”. What is above 100%? Exactly, nothing. That’s the reason why it’s not working for you. Try setting the number to 99, and that should do it. But first, remove the script from your startup folder and reboot your laptop. Don’t hesitate to tell me if that worked for you, as well as to address me any questions or doubts you might still have.

  23. That’s a great tweak and now it’s even better! Check the new update 🙂

    • Programs or shortcuts placed in the start up folder will run whenever Windows starts. You can place the shortcut here by tapping (WIN) + R on your keyboard. Then Type shell:startup <<< This is the startup folder. 🙂

  24. You’ve got the battery.vbs and the shortcut of it. You place the shortcut file into the Start-up folder, what do you do with the original file? Is it suppose to be left on the desktop or can you delete it? Answer please & ty.

  25. My laptop is an Alienware 17 and I’m pretty sure this is a Dell thing, but I have an option when right clicking the battery icon in the system tray called “Desktop Mode Battery Charge” which will automatically optimize battery health by switching to battery when plugged in if the charge level is full. Low battery settings are still in the standard power management Windows application.

    For people who have a Dell or Alienware laptop, they should check it out.

    • I’ve got a Dell and don’t have the option which sent me on the hunt for a solution.

    • I have only done a cursory search on this, but it appears to be something that comes preloaded on some Dell and Alienware laptops. It could be an option that is added by a Dell driver or utility installation.

      Have you asked around on the Dell forums?

  26. Tell me you guys read minds or something!
    Having lost two batteries in last two months due to my inability to take the charger off when the battery is full, I was looking for something like this.
    Battery Delay is another alternative but meh.
    This is a much better way.

    • If only we could read minds. Glad you found it useful. I had to dig around a lot myself and felt the script deserved more attention than it was getting.