请楼主先测试吧:- @echo off&setlocal enabledealyedexpansion
- set /p _path=请输入要操作的目录全路径(请注意要以\结尾):
- set "fg=-----------------------------------------------------------------------"
- echo NAME LANG ADD MOD DEL A^&M BLK CMT NBNC RATE>d:\new.txt
- echo %fg%>>d:\new.txt
- for /f "delims=" %%a in ('dir /s /b %_path%*.txt') do (
- for /f "skip=2 delims=" %%b in (%%a) do (
- if "%%b" equ "%fg%" (
- set /a n+=1
- ) else (
- if "!n!" equ "1" set "flag=a"&echo %%~na %%b>>d:\new.txt
- )
- )
- if not defined flag echo %%~na>>d:\new.txt
- set /a n=0&set "flag="
- )
- echo %fg%>>d:\new.txt
- start d:\new.txt
复制代码
[ 本帖最后由 batman 于 2009-8-8 13:22 编辑 ] |