|(script not tested)|
@echo off & setlocal enabledelayedexpansion
set /a len=4
for /f %%a "tokens=* delims=" in (file) do (
if "!test!" equ !repl! (
) else (
:: do whatever with lines not having leading string...
:: this arrangement is to pass them on, enable foll. to not
:: set test=
>> outfile echo.!test!
(note: as coded here, blank lines are not passed, exclams in inputstream will fail... )