title: Dos Batch String Manipulation using variable
body: <p>I want to do the following throuhg a Dos Batch or Powershell. </p>
  
  <ul>
  <li>a) get ip of local machine and assign to a variable</li>
  <li>b) store the variable for later use.</li>
  <li>c) read an xml file</li>
  <li>d) replace a specific entry in xml file (an ip address) with the ip stored in variable</li>
  <li>e) the value i want to replace is declared inside a tag like so, &lt;"MyOwnIp=127.0.0.1"></li>
  <li>f) save changes to a new file</li>
  <li>g) rename old file, rename new file, delete old file</li>
  </ul>
  
  <p>I tried the following but due to lack of scripting knowledge and experience, I am at a loss. </p>
  
  <pre><code>@echoff
  setlocal enabledelayedexpansion
  set /p myIp= my ip address is %myIp%
  echo %myIp% 
  FOR /F "skip=3 tokens=1-4 delims=&lt;/&gt;" %%I in (file.xml) DO
   set "oldIp=%%I"
   (if !oldIp! neq !myIp! do 
    set !oldIp:myip=%newIp%!
    echo !oldIp!)
  endlocal  
  pause
  </code></pre>
  
  <p>Can anyone help? Thank you. </p>