The "Battery" icon in my Status Bar doesn't work, and I use a Windows Batch-Script to check the battery level. (I don't want a fix for the icon.) But, the output is kind of ugly, with no spaces and a plain number on the next line.
So, How can i convert
EstimatedChargeRemaining
83
to
Battery Level is at 83
(Or anything of the sort.)
P.S: The command I use is WMIC PATH Win32_Battery Get EstimatedChargeRemaining
The following worked for me, and is a modification of @npocmaka's answer (Thanks, npocmaka).
FOR /F "Tokens=1,* Delims==" %%A in (
'wmic PATH Win32_Battery get EstimatedChargeRemaining /Format:list ^| FINDSTR "[0-9]"'
)DO (echo Battery Level is at %%B)
What I have changed:
FINDSTR
Converts output from Unicode to ANSI for parsing by FOR /F