- @echo off
- setlocal enabledelayedexpansion
-
- for /f "delims=" %%a in ('findstr "<Target>.*</Target>" 1.txt') do (
- set Target=%%a
- )
-
- for /f %%n in (' find /c /v "" ^< 2.txt ') do (
- for /l %%a in (1 1 %%n) do (
- set str=
- set /p str=
- if not defined str (
- echo,
- ) else if "!str:</Target>=!" neq "!str!" (
- echo !Target!
- ) else (
- echo,!str!
- )
- )
- ) <2.txt >2.new
-
- move 2.new 2.txt
-
- pause
复制代码
|