toolkit批处理脚本技巧记录

chcp 65001
切换代码页,避免乱码

title=TOOLKIT
设置标题

mode con cols=101 lines=30
设置列数和行数

%~1
已去除引号的参数

for %%i in (%suffix%) do set suffix=%%~xi
后缀名

for /f tokens=2 %%a in ('aapt dump badging %pkg%^|findstr package') do set pkg_name=%%a
获取第2个字段

setlocal enabledelayedexpansion if exist %~dp0\strlen.bat (   call %~dp0\strlen.bat %pkg%   if !errorlevel! leq 68 (set /a non_pkg_len=68-!errorlevel!) else set non_pkg_len=   call %~dp0\strlen.bat %pkg_name%   if !errorlevel! leq 60 (set /a non_pkg_name_len=60-!errorlevel!) else set non_pkg_name_len= ) 

更改参数作用域

set /a retry_time+=1
整型计算

for /f delims= %%a in ('adb -s %serial% shell getprop ro.product.model') do set model=%%a&title=%model%
更改分隔符

%~dp0
当前目录

set /p =^|Current file: %pkg%<nul
打印不换行