bat批量备份手机APP
作者:互联网
adbPath = ADB工具包文件夹(adb+aapt)
backupPath = apk备份文件夹
@echo off & chcp 65001 & cls & cd /d "%~dp0" setlocal enabledelayedexpansion REM adb tool path set "adbPath=D:\software\android-sdk-windows\platform-tools" REM backup path set "backupPath=D:\APP_BAK" mkdir "%backupPath%" >nul 2>nul set "path=%path%;%adbPath%" REM counter set "count=0" for /f "tokens=1* delims=:" %%i in ('adb shell pm list package -3') do ( set /a "count+=1" echo !count!:%%j set "versionCode=" & set "versionName=" & set "remotePath=" & set "chsName=" REM get versionCode,versionName for /f "tokens=1,2 delims== " %%a in ('adb shell pm dump "%%j" ^| findstr /i "versionCode= versionName="') do ( if /i "%%a"=="versionCode" set "versionCode=%%b" if /i "%%a"=="versionName" set "versionName=%%b" ) set "localName=[%%j]-!versionCode!-V!versionName!.apk" REM get remotePath for /f "tokens=2 delims=:" %%a in ('adb shell pm path "%%j"') do set "remotePath=%%a" echo pulling ... REM pull apk if exist "%backupPath%\*!localName!" ( REM if exist ,skip backup for %%a in ("%backupPath%\*!localName!") do echo skip %%a ) else ( adb pull "!remotePath!" "%backupPath%\!localName!" >nul REM get chinese name for /f "tokens=2 delims=:'" %%a in ('aapt dump badging "%backupPath%\!localName!" ^| findstr /i "application-label:"') do set "chsName=%%a" REM rename if not "!chsName!"=="" move /y "%backupPath%\!localName!" "%backupPath%\!chsName!!localName!" >nul echo done. %backupPath%\!chsName!!localName! ) echo -------------------------------------------------- ) echo backup done. pause&exit
标签:bat,set,%%,APP,echo,REM,localName,backupPath%,备份 来源: https://www.cnblogs.com/ai594ai/p/15019924.html