网上查了好多办法,都是错的,被误导了好久,经过测试,可行的方法如下:
有两种写法,都是可以的。
写法一:
忽略设备名:
adb shell "dumpsys window | grep mCurrentFocus"
带设备名
adb -s 设备号 shell "dumpsys window | grep mCurrentFocus"
写法二:
忽略设备名:
adb shell dumpsys window | findstr mCurrentFocus
带设备名
adb -s 设备号 shell dumpsys window | findstr mCurrentFocus
–华丽的分割线–
两种写法的区别就在于你喜不喜欢带引号,不喜欢带引号就用第二种,否则第一种不带引号会报错。