Just adding to this, I needed to make sure a batch script won't run on a laptop with a low battery, but also work for desktops without a battery.
SET BatteryPercent=100
FOR /F "tokens=2 delims==" %%i in ('WMIC PATH Win32_Battery Get EstimatedChargeRemaining /Value 2^>^&1') DO SET BatteryPercent=%%i
IF %BatteryPercent% LSS 20 (EXIT)
So this sets the battery variable to 100 then overwrites it with the actual battery value, so that desktops will report 100. The weird bit after /Value is just to suppress the battery device not found error on desktops.