- echo off
- ::adb临时加入到path环境变量
- set My_PATH=.\SDK\adb
- set PATH=%PATH%;%My_PATH%
-
- md .\bak\
- setlocal enabledelayedexpansion
- ::列出已装的app
- for /f "usebackq delims=:== tokens=2,3,4" %%i in (`adb shell pm list packages -f -3`) do (
-
- pause
- for /f tokens^=6^ delims^=^' %%a in ('.\SDK\aapt2\aapt2.exe dump badging .\bak\%%k.apk ^|findstr /c:"versionName"') do set A=%%a
- for /f tokens^=2^ delims^=^= %%a in ('adb shell dumpsys package %%k ^|findstr versionName') do set B=%%a
- if %B% EQU %A% echo goto exit
- if %B% GTR %A% echo goto 备份apk
- pause
-
- @if "%%k"=="" (adb pull %%i %%j.apk) else ( adb pull %%i==%%j .\bak\%%k.apk )
- )
- pause
复制代码
|