- @echo off&setlocal enabledelayedexpansion
- set /p ph=请输入目录路径:
- set "fg=-----------------------------------------------------------------------"
- >"%ph%\new.txt" echo NAME LANG ADD MOD DEL A^&M BLK CMT NBNC RATE
- >>"%ph%\new.txt" echo %fg%
- for /f "delims=" %%a in ('dir /s /b /a-d %ph%\*.txt') do (
- for /f "skip=2 usebackq delims=" %%b in ("%%a") do (
- if "%%b"=="%fg%" (
- if defined flag (set flag=&if not defined %%~na >>"%ph%\new.txt" echo %%~na)else set flag=f
- ) else if defined flag >>"%ph%\new.txt" echo;%%~na %%b&set "%%~na=a"
- ))
- >>"%ph%\new.txt" echo %fg%
- start "" "%ph%\new.txt"
复制代码
|