- @echo off&setlocal enabledelayedexpansion
- set "SrcDir=F:\Test Dir"
- set "SrcFile=F:\Test Dir\1.txt"
- for /f "delims=" %%a in ('dir /a-d/s/b "%SrcDir%"') do (
- set/a index=0
- if "%%a" neq "%SrcFile%" (
- for /f "delims=" %%b in ('findstr /n .* "%%a"') do (
- set "var=%%b"&&set var=!var:*:=!
- (echo.!var!)>>"%%a.log"
- if !index!==2 for /f "delims=" %%c in ('findstr /n .* "%SrcFile%"') do (
- set "var=%%c"&&set var=!var:*:=!
- (echo.!var!)>>"%%a.log"
- )
- set/a index+=1
- )
- )
- )
复制代码
|