@echo off
for /F %%i in ('adb shell pidof com.packagename.youself') do ( set GetPid=%%i)
echo 得到PID:%GetPid%
adb shell logcat --pid %GetPid% -s Unity
用法 :for循环那行pidof后面 包名 换成你自己的包名。
本文介绍了一种在Android设备上通过ADB命令获取指定应用的进程ID(PID)及日志的方法。使用for循环结合adb shell命令,替换包名为目标应用的包名,即可实现PID的获取和针对性的日志读取。
@echo off
for /F %%i in ('adb shell pidof com.packagename.youself') do ( set GetPid=%%i)
echo 得到PID:%GetPid%
adb shell logcat --pid %GetPid% -s Unity
用法 :for循环那行pidof后面 包名 换成你自己的包名。

被折叠的 条评论
为什么被折叠?
