本帖最后由 went 于 2020-4-12 21:04 编辑
批量替换,ANSI保存,先测试再删掉15行的REM- @echo off
- REM dir
- set "dir=C:\Users\lenovo\Desktop\0"
- REM key-value
- set "keys=AB:CF CD:JH VC:BG"
- for /f "tokens=1* delims=-" %%i in ('dir /b "%dir%\*.jpg"') do (
- echo %dir%\%%i-%%j
- call set "fileName=%%i"
- for %%a in (%keys%) do (
- for /f "tokens=1-2 delims=:" %%b in ("%%a") do (
- call set "fileName=%%fileName:%%b=%%c%%"
- )
- )
- call echo %%fileName%%-%%j
- REM call rename "%dir%\%%i-%%j" "%%fileName%%-%%j" && echo 成功! || echo 失败!
- echo ---------------
- )
- echo 完成!
- pause&exit
复制代码
|