美文网首页
【原创】【批处理】安卓批处理指令(win下有用)

【原创】【批处理】安卓批处理指令(win下有用)

作者: 亡禁 | 来源:发表于2020-06-18 14:41 被阅读0次

前提

将ADB命令添加至path环境变量中

获取安卓当前的运行的Activity


@echo off

@for /f "skip=1 usebackq" %%i in (`adb devices`)  do call:print_deviceInfo %%i

goto :eof

:print_deviceInfo

for /f "tokens=1 usebackq" %%i in (`adb -s %1 shell getprop ro.product.manufacturer`) do set manufacturer=%%i

for /f "tokens=1,2,3 usebackq" %%i in (`adb -s %1 shell getprop ro.product.model`) do set model=%%i %%j %%k

echo ===%manufacturer% %model% (%1)===

adb -s %1 shell dumpsys activity top|findstr ACTIVITY

echo.

goto :eof


将上述内容保存到bat文件中,手机连至当前电脑时,运行该批处理文件,即可获取当前手机正在运行的应用包名及Activity名称

运行截图

相关文章

网友评论

      本文标题:【原创】【批处理】安卓批处理指令(win下有用)

      本文链接:https://www.haomeiwen.com/subject/hmlqyctx.html