title: How to change directory and execute a file there in Java
body: <p>I have to execute the following <code>cmd</code> commands of Windows in Java.</p>
  
  <p><strong>The <code>cmd</code> commands:</strong></p>
  
  <pre><code>Microsoft Windows [Version 6.1.7600]
  Copyright (c) 2009 Microsoft Corporation.  All rights reserved.
  
  //First i have to change my default directory//
  
  C:\Users\shubh&gt;D:
  
  //Then move to a specific folder in the D drive.//
  
  D:\&gt;cd MapForceServer2017\bin\
  
  //then execute the .mfx file from there.
  
  D:\MapForceServer2017\bin&gt;mapforceserver run C:\Users\shubh\Desktop\test1.mfx 
  </code></pre>
  
  <p><strong>Result of the execution</strong></p>
  
  <pre><code>Output files:
  library: C:\Users\shubh\Documents\Altova\MapForce2017\MapForceExamples\Tutorial\library.xml
  Execution successful.
  </code></pre>