We can set low/critical battery sound notification but I don't know how to set a full battery sound notification, Is there any way to do that?
EDIT : I agree to the point that not all laptops charge to 100%, then my question rephrases from 100% to 95%, or maybe to get a notification at some specified %age...
答案1
I cannot set a full battery sound notification, is there any way to do that?
Use the following batch file (Battery.cmd):
@echo off
setlocal EnableDelayedExpansion
rem set threshold value
set _threshold=95
:start
rem get the battery charge
rem use findstr to strip blank lines from wmic output
for /f "usebackq skip=1 tokens=1" %%i in (`wmic Path Win32_Battery Get EstimatedChargeRemaining ^| findstr /r /v "^$"`) do (
set _charge=%%i
echo !_charge!
if !_charge! geq !_threshold! (
echo charge reached
goto :done
) else (
rem wait for 10 minutes then try again
timeout /t 600 /nobreak
goto :start
)
)
:done
endlocal
Notes:
- This batch file monitors the current battery percentage charge and prints "charge reached" when the charge reaches a user defined threshold value (in this case 95%). The batch file then ends. If the charge goes below the threshold, the user must manually run the batch file again.
- Set
_threshold
as required. - Replace the
echo charge reached
command with a command to play your chosen sound.- If you want to create a user defined event (in the event log) instead of playing a sound then see my answer Windows event id for battery level change.
- Modify the
timeout
delay as required for your situation.
Further Reading
An A-Z Index of the Windows CMD command line - An excellent reference for all things Windows cmd line related.
wmic - Windows Management Instrumentation Command.