- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /s/b/l/aa *.txt') do (
- for /f "delims=" %%a in (%%i) do (
- set/a n+=1
- if !n! equ 1 set "a1=%%a"
- if !n! equ 2 set "a2=%%a"
- )
- set n=0
- for /f "skip=2 delims=" %%b in (%%i) do (
- set/a a+=1
- if !a! equ 1 (echo,!a1!
- echo,%%~ni
- echo,!a2!)>%temp%\%%~nxi
- echo,%%b >>%temp%\%%~nxi
- )
- set a=0&set a1=&set a2=
- move /y "%temp%\%%~nxi" "%%i"
- )
- pause
复制代码
|