android 批量安装卸载bat

  • Post author:
  • Post category:其他


@echo off
setlocal enabledelayedexpansion
CLS
color 17
@title 安装多设备程序  By  qiuranke  2012-08-14
:MENU
echo.               =-=-=-=-=安装多设备程序菜单=-=-=-=-= 
echo.
echo. 1 运行adb start-server 等待设备接入
echo.
echo. 2 结束adb start-server
echo.
echo. 3 安装此目录下的所有apk
echo.
echo. 4 删除dellist.txt中的所有apk
echo.
echo. 5 查看列表
echo.
echo. 6 查看包信息
echo.
echo. 7 退出
echo.
echo. 请输入选择项目的序号并按回车键运行:
:0
set /p XUANXIANG= 
if "%XUANXIANG%"=="1" goto 1
if "%XUANXIANG%"=="2" goto 2
if "%XUANXIANG%"=="5" goto 5
if "%XUANXIANG%"=="6" goto 6
if "%XUANXIANG%"=="7" goto 7
goto 0
:1
echo 判断adb是否运行
tasklist /M adb* |find "adb.exe"&&echo adb已经运行&&goto 0
adb start-server
echo adb已经运行
goto 0
:2
tasklist /M adb* |find "adb.exe"&&taskkill /f /im adb.exe&&echo adb已经终止&&goto 0
echo adb未运行
goto 0
:3
adb devices >list.txt
for /f "delims=" %%a in ('findstr "^.*^ device$" list.txt')do (
	set str=%%a
	for /f "delims=" %%i in ('dir /b *.apk') do (
		echo adb -s !str:~0,-7! install -r "%%i"
		start adb -s !str:~0,-7! install -r "%%i"
	) 
)
del list.txt
goto 0
:4
adb devices >list.txt
for /f "delims=" %%a in ('findstr "^.*^ device$" list.txt')do (
	set str=%%a
	for /f "delims=" %%i in (dellist.txt) do (
		echo adb -s !str:~0,-7! uninstall "%%i"
		start adb -s !str:~0,-7! uninstall "%%i"
	) 
)
del list.txt
goto 0
:5
adb devices
goto 0
:6
for /f "delims=" %%i in ('dir /b *.apk') do (
	aapt d badging "%%i" >apkinfo.txt
	for /f "delims=" %%s in ('findstr "package: name=\'*\' versionCode=" apkinfo.txt') do (
		echo package "%%s"
	) 
	del apkinfo.txt
) 
goto 0
:7

需要如下:

adb.exe

aapt.exe

AdbWinApi.dll

AdbWinUsbApi.dll

dellist.txt  里面为删除的包名

http://download.csdn.net/detail/fang00y/4580490 下载地址……3分



版权声明:本文为fang00y原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。