{"id":2144,"date":"2021-10-27T14:25:00","date_gmt":"2021-10-27T14:25:00","guid":{"rendered":"https:\/\/lgildv5i97.onrocket.site\/answers\/?post_type=question&#038;p=2144"},"modified":"2021-10-27T14:26:27","modified_gmt":"2021-10-27T14:26:27","slug":"replace-text-in-xml-using-batch-file","status":"publish","type":"question","link":"https:\/\/computing.net\/answers\/programming\/replace-text-in-xml-using-batch-file\/20672.html","title":{"rendered":"Replace Text In XML Using Batch File"},"content":{"rendered":"<p>I have put this question in the wrong forum. re-posting it here:<br \/>\nI am trying to change the project version in a xml file<br \/>\nusing dos. when i execute the following code, an empty new.xml is created..there is nothing on the stdout as well. plz help<\/p>\n<p>&#8212;&#8212;<br \/>\nsetLocal EnableDelayedExpansion &gt; new.xml<\/p>\n<p>for \/f &#8220;tokens=* delims= &#8221; %%a in (%1) do (<br \/>\necho %%a<br \/>\nif %%a equ &#8220;^&lt;currentVersion^&gt;3.0.0^&lt;\/currentVersion^&gt;&#8221; (<br \/>\necho ^&lt;currentVersion^&gt;3.0.0.1^&lt;\/currentVersion^&gt; &gt;&gt;new.xml<br \/>\n) else (<br \/>\necho %%a<br \/>\necho %%a&gt;&gt; new.xml<br \/>\n)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"inline_featured_image":false,"iawp_total_views":10},"question-category":[55],"question_tags":[],"class_list":["post-2144","question","type-question","status-publish","hentry","question-category-programming"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question\/2144","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question"}],"about":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/types\/question"}],"author":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/comments?post=2144"}],"wp:attachment":[{"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/media?parent=2144"}],"wp:term":[{"taxonomy":"question-category","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question-category?post=2144"},{"taxonomy":"question_tags","embeddable":true,"href":"https:\/\/computing.net\/answers\/wp-json\/wp\/v2\/question_tags?post=2144"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}