其实纯批也可以,在连续的^字符之间加空格,最后面加补位字符- @echo off
- set "folderName=AB^CD^^"
- setlocal enabledelayedexpansion
- for /f "tokens=1,2* delims=^" %%i in ("!folderName:^= ^!$") do (
- endlocal
- set "s1=%%i"
- set "s2=%%j"
- set "s3=%%k"
- setlocal enabledelayedexpansion
- set "s3=!s3: ^=^!"
- echo;ren "!folderName!" "!s1:~0,-1!^^!s2:~0,-1!00!s3:~0,-1!"
- )
- pause
复制代码 输出:ren "AB^CD^^" "AB^CD00^" |