- @echo off
- 2>nul md "result\"
- for /f "delims=" %%a in ('dir /a-d/b *.txt') do (
- echo;"%%a"
- >nul find "#" "%%a"&&(set "file=%%a"&call :loop)||copy "%%a" "result\"
- )
- pause&exit
- :loop
- >"result\%file%" (for /f "delims=" %%b in ('findstr /n .* "%file%"') do (
- set "line=%%b"
- setlocal enabledelayedexpansion
- if "!line:#=!" neq "!line!" (
- for /f "delims=#" %%d in ("!line!") do set "endline=%%d"
- echo;!endline:*:=!
- goto :eof
- ) else echo;!line:*:=!
- endlocal
- ))
复制代码
|