title: Windows batch script to replace a string
body: <p>I have a txt file that looks like this:</p>
  
  <h2>file: config.txt</h2>
  
  <pre><code>property name="java.nio.preferSelect" value="true"
  
  property name="pico.rcp.platform.host" value="172.22.3.11"
  
  property name="pico.rcp.platform.port" value="6790"
  </code></pre>
  
  <hr>
  
  <p>I want a windows batch script that will search for "pico.rcp.platform.host" string and change the IP value in that line regardless its value to the passed value in the command line. Like the following:</p>
  
  <p>changeServerTo.bat "172.22.3.1" config.txt</p>
  
  <p>the above script should make the file looks like this:</p>
  
  <h2>file: config.txt</h2>
  
  <pre><code>property name="java.nio.preferSelect" value="true"
  
  property name="pico.rcp.platform.host" value="172.22.3.1"
  
  property name="pico.rcp.platform.port" value="6790"
  </code></pre>
  
  <hr>
  
  <p>and </p>
  
  <p>changeServerTo.bat "172.22.100.221" config.txt</p>
  
  <p>should make the file looks like this:</p>
  
  <h2>file: config.txt</h2>
  
  <pre><code>property name="java.nio.preferSelect" value="true"
  
  property name="pico.rcp.platform.host" value="172.22.100.221"
  
  property name="pico.rcp.platform.port" value="6790"
  </code></pre>
  
  <hr>
  
  <p>and so on.</p>
  
  <p>Your help is much appreciated.</p>
  
  <p>Thanks in advance.</p>