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
打印不换行
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步