把批处理跟“文本a.txt”“文本b.txt”放在一起运行- @echo off
- 2>nul del $*.log
- set "fa=文本a.txt"
- set "fb=文本b.txt"
- for /f "skip=1 delims=" %%a in ('type "%fa%"') do (
- for /f "tokens=1,2*" %%b in ("%%a") do (
- if "%%d" equ "" (
- >>"$1.log" echo;%%a
- set #%%b%%c=1
- ) else >>"$2.log" echo;%%a
- )
- )
- for /f "delims=" %%a in ('type "%fb%"') do (
- for /f "tokens=1,2*" %%b in ("%%a") do (
- if defined #%%b%%c (
- >>"$3.log" echo;%%a
- ) else >>"$4.log" echo;%%a
- )
- )
- pause
复制代码
|