im using adb shell commands to check if my devices' screen is on or not
adb shell dumpsys power | find "mWakefulness="
if the screen is off this command returns mWakefulness=Asleep
what i want to do is assign the output of that command to a variable and run it through an if statement to check if mWakefulness=Asleep
ive tried this
@echo off
for /f "delims=" %%a in ('adb shell dumpsys power | find "mWakefulness="') do (
Set "Output=%%a"
)
Echo Output Result = "%OutPut%"
but this returns | was unexpected at this time.
so i tried to surround adb shell dumpsys power | find "mWakefulness="
with double quotes
@echo off
for /f "delims=" %%a in ('"adb shell dumpsys power | find "mWakefulness=""') do (
Set "Output=%%a"
)
Echo Output Result = "%OutPut%"
but this returns Output Result = ""
can anyone help?