APK批量安装脚本.
说明:
创建installAPK.bat,右键文本打开粘贴如下内容:
@echo off&setlocal enabledelayedexpansion
title InstallAPK
color 0a
rem +++++++++++++++++++++++++++++++++++++++++++
rem InstallAPK.bat
rem Godfeer @20190419
rem
rem Version: 1.0
rem +++++++++++++++++++++++++++++++++++++++++++
rem 两个adb devices 为了减少deamon start successfully语句写入deviceId.txt中
adb devices
adb devices >deviceId.txt
rem 处理0台设备的情况
set count=0
type nul>temp.txt
rem tonkes与delims的位置不能改变,否则会出现显示混乱
for /f "skip=1 tokens=1 delims= " %%i in (deviceId.txt) do (
echo %%i >>temp.txt
set /a count+=1
)
echo 总共!count!台设备
for /f %%i in (temp.txt) do (
start "Device:%%i" cmd /k "@echo off& for /r "%cd%\apkPackage\" %%a in (*.apk) do ( echo APK=%%~nxa &adb -s %%i install -r %%a)"
)
del temp.txt
pause
在windows下新建apkPackage
下面放要安装的apk
使用adb connect 连接所有要安装apk的设备
双击installAPK.bat
即可开始批量安装
logcat日志抓取脚本
创建logSave.bat,右键文本打开粘贴如下内容:
::bat制作抓取Android设备的logcat,并保存以时间命名的txt文件至设备目录 1 @ECHO off
adb wait-for-device
ECHO 正在连接设备
adb logcat -c
@ECHO off
::获取设备名称
adb pull system/build.prop log\temp.txt
find "ro.product.name" log\temp.txt >log\1.txt
for /f "skip=2" %%i in (log\1.txt) do set m=%%i
set name=%m:~16%
::获取设备名称结束
::新建设备文件夹
if not exist log\%name% md log\%name%
del log\temp.txt
del log\1.txt
::新建设备文件夹结束
::获取当前系统时间
set day=%date:~0,4%%date:~5,2%%date:~8,2%
set temp=%time:~0,2%
if /i %temp% LSS 10 (
set hour=0%time:~1,2%_%time:~3,2%_%time:~6,2%
)else (
set hour=%time:~0,2%_%time:~3,2%_%time:~6,2%
)
::获取当前系统时间结束
::输出以当前时间命名的txt文件至设备文件下
ECHO 正在抓取%m:~16%日志
adb logcat -v time *:V >log\%name%\%day%_%hour%.txt
抓取指定包名的log日志
创建pids.bat,右键文本打开粘贴如下内容:
@echo off
adb shell "ps | grep com.putao.abc"
创建logcat.bat,右键文本打开粘贴如下内容:
@echo off
for /f "tokens=2 delims= " %%i in ('pids.bat') do set pid=%%i
echo %pid%
adb logcat | find "%pid%" >logcat.log
pause
文件下载地址:GitHub