I'm trying to replace a string in one text file but that string contains some special characters (=,"") inside so I'm unable to replace the string as expected.
I've written following batch command and it works well with normal string (like "1234", "nanana") but not with the string I'm trying. I tried caret also to escape special characters but no luck.
Can anybody help me out with this as I'm new to batch.
@echo off
setlocal enableextensions disabledelayedexpansion
set "search=<add key="Domain" value="001" />"
set "replace=<add key="Domain" value="001" />"
set "textFile=C:\Signing\SigningTool\Input.txt"
for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
>>"%textFile%" echo(!line:%search%=%replace%!
endlocal
)
the exact string I want to replace is <add key="Domain" value="001" />
with <add key="Domain" value="000" />