I have a file context.xml which contains following..
<import resource="beans.xml"/>
I need to comment this line as follows using batch file.. Please help.. Thanks in advance..
<!--import resource="beans.xml"/-->
I tried this.. But its not working..
@echo off
setlocal enableextensions enabledelayedexpansion
set "search= <import resource="beans.xml"/> "
set "replace= <!--import resource="beans.xml"/--> "
set "textFile=context.xml"
for /f "delims=" %%i in ('type "%textFile%" ^& break ^> "%textFile%" ') do (
set "line=%%i"
setlocal enabledelayedexpansion
set "line=!line:%search%=%replace%!"
>>"%textFile%" echo(!line!
endlocal
)