test.bat- @echo off & cd /d "%~dp0"
- setlocal enabledelayedexpansion
- set "s=----------"
- for %%i in (*.txt) do (
- for /f "tokens=1* delims=:" %%a in ('findstr /n .* "%%i"') do (
- if not "%%b"=="%s%" (
- if "!a!"=="1" (
- set "b=%%b"
- set /a "a=0"
- ) else call set "_!b!=%%_!b!%%;"%%b";"
- ) else set /a "a=1"
- )
- (
- for /f "tokens=1,2* delims==_" %%a in ('set _') do (
- echo %s%
- echo %%a
- set "_%%a="
- for %%d in (%%b) do echo.%%~d
- )
- ) > "%%~ni-1.txt"
- echo %%~ni-1.txt
- )
- pause&exit
复制代码
|