Looping replace
Posted: 30 Jul 2013 13:49
Is it possible to loop this script in a for each command to perform on each file in a given folder?
Code: Select all
@echo off
set "replace=system"
set "replaced=offline"
set "source=control.reg"
set "target=control2.reg"
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