本帖最后由 smss 于 2020-7-11 19:08 编辑
- @echo off&setlocal enabledelayedexpansion
- for /f "tokens=1,2,3 delims=第章" %%i in ('dir *.txt /b/s') do (set m=%%j
- if not "!m!"=="" (set n=0&set o=.&call :s
- if "!m:~-1!"=="十" set o=!o!0
- set "p=%%k"&set p=!p: =!
- ren "%%i第!m!章%%k" "第!o:~1!章!p!"
- ))
- pause
- goto :eof
- :s
- set t=!m:~%n%,1!
- if not "!t!"=="" (
- if "!t!"=="一" set o=!o!1
- if "!t!"=="二" set o=!o!2
- if "!t!"=="三" set o=!o!3
- if "!t!"=="四" set o=!o!4
- if "!t!"=="五" set o=!o!5
- if "!t!"=="六" set o=!o!6
- if "!t!"=="七" set o=!o!7
- if "!t!"=="八" set o=!o!8
- if "!t!"=="九" set o=!o!9
- if "!t!"=="十" if "!n!"=="0" set o=!o!1
- set/a n+=1
- goto s)
- :eof
复制代码
|