I want to create a batch while which finds specific lines in a batch file and are able to edit these lines.
Example:
//TXT FILE//
ex1
ex2
ex3
@echo off
set "replace=something"
set "replaced=different"
set "source=Source.txt"
set "target=Target.txt"
setlocal enableDelayedExpansion
(
for /F "tokens=1* delims=:" %%a in ('findstr /N "^" %source%') do (
set "line=%%b"
if defined line set "line=!line:%replace%=%replaced%!"
echo(!line!
)
) > %target%
endlocal
Source. Hoping it will help some one.