title: Change content of batch file
body: <p>How to change content of batch file using Java code?</p>
  
  <p>I worked with parsing XML using Java program. It worked fine. But can I do same for the batch file using Java? </p>
  
  <p>I am able to run batch file using below code.</p>
  
  <pre><code>String command = "cmd /c start " + batFile;
  Runtime rt = Runtime.getRuntime();
  rt.exec(command);
  </code></pre>
  
  <p>The content of my batch file is:</p>
  
  <pre><code>@echo off
  cd C:\Program Files (x86)\SourceMonitor
  start SourceMonitor.exe /C "C:\shravani-workspace\appanalytix\src\main\resources\appanalysis.xml"
  exit
  </code></pre>
  
  <p>But before doing this I want to change location </p>
  
  <pre><code>C:\shravani-workspace\appanalytix\src\main\resources\appanalysis.xml
  </code></pre>
  
  <p>..to user given XML location. How can I achieve this in my Java application?</p>