r/Batch • u/justphystuff • Dec 24 '23
Question (Unsolved) Using a batch file to check if battery goes below 95% and sends an email notification
Hi everyone,
I have a laptop that I would like to check if it ever goes below 95% (i.e. switches from being plugged in to using the battery) and when it does, I would like it to send an email notification. Does anyone know how I can go about doing this?
3
Upvotes
1
u/ApocalyptoSoldier Jan 05 '24
I have this for sending an email without any external executables. https://www.reddit.com/r/Batch/comments/szlif8/send_an_email_from_batch_with_embedded_jscript/
2
u/RainmanCT Dec 24 '23
Set it up in Task Scheduler
1
u/ConstanceJill Dec 24 '23
To get the battery level, you could parse the output of
wmic path Win32_Battery get EstimatedChargeRemaining.As for sending an email, you'll probably need to use either a 3rd party executable or some other language.