回复 7# dzwind
- @echo off
- if "%~1" equ "" (
- exit
- ) else (
- pushd "%~1" || exit
- )
- for /f "delims=" %%i in ('dir /b /a-d "*.doc?"') do (
- set n=%%~ni
- set x=%%~xi
- for /f "tokens=1 delims=0123456789" %%a in ("\%%~ni") do (
- set _n=\%%~ni
- setlocal enabledelayedexpansion
- for /f "delims=" %%b in ("!_n:%%a=!") do (
- endlocal
- set nn=%%b
- setlocal enabledelayedexpansion
- ren "!n!!x!" "!nn:~0,1!!nn:~0,1!!nn:~0,1!!nn:~0,1!_!n:~-2!!x!"
- endlocal
- )
- )
- )
- pause
复制代码
|