How comment lines in XML file using Batch file? [duplicate]
This question already has an answer here: How can you find and replace text in a file using the Windows command-line environment? 24 answers 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 )
check the replacer.bat : call replacer.bat e?content.xml "<import resource=\u0022beans.xml\u0022/>" "<!--import resource=\u0022beans.xml\u0022/-->" as you have quotes in the strings you want to replace you need e? before the file name which will evaluate the special symbols.
Need to remove XML envelope with XSLT
Passing data between XML Views in SAP UI5
how to call all the views from viewholder through different functiions android
Error on importxml function in Google Spreadsheet while scraping Google
macro - can you scrape an xml file and then use it to fill a web form?
read RDF/XML from url in Jena
When does XML receive it's value to display?
Add new tag to the XML using Batch script
space between xml tags
XSL - check if attribute is equal to the selected value
VB.Net TableAdapter XSD file has “randomly” stopped working
Convert XML to CSV with XSLT
Obtain value from XML element using XML parser and assign it to a variable
How to parse xml in powershell
How to hide External Header in Odoo reports using XML
How can I parse XML in PowerShell when each property has a unique name?