1.txt为要插入内容的文本, 2.txt为要要插入的文本。 case11880为1.txt中的目标行,文本要插入到这行的上面。 3.txt为最后的成品
@echo off
set "s=case11880"
(for /f
"delims=" %%i
in ('findstr /n .* "1.txt"') do (
set "str=%%i"
setlocal enabledelayedexpansion
set "str=!str:*:=!"
if defined str
(
for /f
"tokens=*" %%j
in ("!str!") do (
echo !str
!
if /i
"%%j" == "!s!" type "2.txt"
)
)else echo.
endlocal
))>tem.t
move tem.t 3.txt
pause