本帖最后由 weichenxiehou 于 2012-6-13 20:37 编辑
- @echo off&setlocal enabledelayedexpansion
- cls&set/p num=Input start number:
- ::delete non-"section 1" files except myself
- for /f "delims=" %%a in ('dir/b^|findstr /iv /c:"section 1"^|findstr
-
- /v "^%~nx0$"') do del "%%a"
- ::rename left files and generate logfile
- (for /f "delims=" %%a in ('dir/b^|findstr /v "^%~nx0$ record.txt"') do
-
- (
- set "filename=%%a"&set "filename=!filename: Section 1=!"
- ren "%%a" "!num!%%~xa"
- for %%i in ("filename!") do echo,!num!.%%~ni
- set/a num+=1
- ))>record.txt
复制代码 将bat放到该文件夹下运行即可。 |