回复 17# haichuan5121
放到jpg文件夹中运行,重命名当前文件夹中的jpg文件- @echo off
- REM key-value
- set "keys=AB:CF CD:JH VC:BG"
- for /f "delims=" %%i in ('dir /b "*.jpg"') do (
- echo %%i
- set "file=?%%~i"
- REM delims=后面是A与BCD之间的分隔符(-_)支持多个
- for /f "tokens=1 delims=-_" %%a in ("%%~i") do (
- set "A=%%a"
- for %%a in (%keys%) do (
- for /f "tokens=1-2 delims=:" %%b in ("%%a") do (
- call set "A=%%A:%%b=%%c%%"
- )
- )
- call :replace "?%%a" "%%A%%"
- )
- call echo %%file%%
- REM call rename "%%~i" "%%file%%" && echo 成功! || echo 失败!
- echo -----------------------
- )
- echo 完成!
- pause&exit
- :replace
- call set "file=%%file:%~1=%~2%%"
复制代码
|