However, an undesirable result is shown as below, and I think the cause is "=".
[Edit_txt.bat]
Code: Select all
@echo off
set "replace=MAX_SCALE-MARKINGS_VAL=20000"
set "replaced=MAX_SCALE-MARKINGS_VAL=500"
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: MAX_SCALE-MARKINGS_VAL=20000
Target(result): 20000=MAX_SCALE-MARKINGS_VAL=500=20000
the result i wanted was: MAX_SCALE-MARKINGS_VAL=500
Can I get some help?