I have tried to replace in my XML page a string using batch but I can't succeed to replace it fully.
I have this batch code:
@echo off
setlocal EnableDelayedExpansion
set _search=logLevel^="3"
set _replace=logLevel^="4"
for /F "delims=*" %%a in (config.xml) do (
set line=%%a
setlocal EnableDelayedExpansion
>> newconfig.xml echo(!line:%_search%=%_replace%!
endlocal
)
echo "done"
pause >nul
And I am trying to modify this line of code in my XML:
<logger logfileDirectory="path/to/logging/" logLevel="3"/>
...from logLevel="3" to logLevel="4":
<logger logfileDirectory="path/to/logging/" logLevel="4"/>
But it always returns me:
<logger logfileDirectory="path/to/logging/" "3"=logLevel="4"="3"/>
What did I do wrong?
Take a look at replacer.bat
call replacer.bat "e?C:\content.txt" "<logger logfileDirectory=\u0022path/to/logging/\u0022 logLevel=\u00223\u0022/>" "<logger logfileDirectory=\u0022path/to/logging/\u0022 logLevel=\u00224\u0022/>"
you can check also FindRepl and JRepl which are more sophisticated tools
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With