@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "search=OLDSTRING"
set "replace=NEWSTRING"
set "textFile=*.bch"
set "rootDir=."
for %%j in ("%rootDir%\%textFile%") do (
For /F "Tokens=1*Delims=]" %%A In ('Find /V /N ""^<"%%~j"^&Break^>"%%~j"'
)Do (Set "line=%%B"
SetLocal EnableDelayedExpansion
(If Not "%%B"=="" (Echo(!line:%search%=%replace%!)Else Echo()>>"%%~j"
EndLocal)
)
endlocal
setlocal EnableExtensions DisableDelayedExpansion
set "search=OLDSTRING"
set "replace=NEWSTRING"
set "textFile=*.bch"
set "rootDir=."
for %%j in ("%rootDir%\%textFile%") do (
For /F "Tokens=1*Delims=]" %%A In ('Find /V /N ""^<"%%~j"^&Break^>"%%~j"'
)Do (Set "line=%%B"
SetLocal EnableDelayedExpansion
(If Not "%%B"=="" (Echo(!line:%search%=%replace%!)Else Echo()>>"%%~j"
EndLocal)
)
endlocal