I have to replace an XML node attribute value using a batch file, XSLT and other methods are not an option.
Node attribute to find:
add key="RemEnabled" value="true" />
To be replaced with:
add key="RemEnabled" value="false" />
I am struggling with the fact there are quotes, what I have so far is:
echo off
setlocal enabledelayedexpansion
set txtfile=x.config
set newfile=xnew.config
if exist "%newfile%" del /f /q "%newfile%"
for /f "tokens=*" %%a in (%txtfile%) do (
set newline=%%a
set newline=!newline:^"RemEnabled^" value=^"true^"=^"RemEnabled^" value=^"false^"!
echo !newline! >> %newfile%
)
Any help much appreciated