@echo off
cd C:\Users\huanfang.zhu\Desktop
del a.txt,temp.txt,b.txt,2.txt
adb devices > C:\Users\huanfang.zhu\Desktop\a.txt
:1.首先获取连接到电脑的手机的设备信息将其保存到C盘的a.txt文件中:
:2.将保存的txt文件中的内容只保留设备编号:
:开始循环安装操作,命令如下:
for /f “delims=” %%a in (C:\Users\huanfang.zhu\Desktop\a.txt) do (
set str=%%a
echo.%str%>temp.txt
goto :next
)
:next
more +1 C:\Users\huanfang.zhu\Desktop\a.txt>C:\Users\huanfang.zhu\Desktop\temp.txt
:去掉空格后面的内容
for /f "delims=^ " %%i in (C:\Users\huanfang.zhu\Desktop\temp.txt) do (echo %%i>>C:\Users\huanfang.zhu\Desktop\2.txt)
for /f “delims=” %%i in (C:\Users\huanfang.zhu\Desktop\2.txt) do (
:高版本到低版本,首先要卸载才能安装:
:低版本到高版本此句应注释:
adb -s %%i uninstall com.hskj.read
adb -s %%i install -r -d F:\Crystal文件夹\花生项目\花生读书\版本\1.0.3.apk
:获取当前安装的版本号:
adb -s %%i shell dumpsys package com.hskj.read | findstr versionName
echo %%i 安装成功
)
pause