访问adb时找不到Android findstr

时间:2015-03-31 06:01:38

标签: android adb

我试图在Process

的帮助下从java执行adb shell命令
   String command = "adb shell dumpsys battery | findstr status";
   Process ps = Runtime.getRuntime().exec(command);

返回 / system / bin / sh:findstr:not found

如果我从命令提示符 python脚本运行相同的命令,它会显示预期的结果。

1 个答案:

答案 0 :(得分:2)

您无法在移动设备上运行adb,并且findstr命令仅在Windows上为AFIK。在shell中的机器人构建中不允许使用linux等效的grep,因此您只需执行dumpsys battery并使用您自己的代码过滤相关部分。