title: How to run Windows commands in JAVA and return the result text as a string
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2007425/get-output-from-a-process">Get output from a process</a><br>
    <a href="https://stackoverflow.com/questions/4031390/executing-dos-commands-from-java">Executing DOS commands from Java</a>  </p>
  </blockquote>
  
  
  
  <p>I am trying to run a cmd command from within a JAVA console program e.g.:</p>
  
  <pre><code>ver
  </code></pre>
  
  <p>and then return the output of the command into a string in JAVA e.g. output:</p>
  
  <pre><code>string result = "Windows NT 5.1"
  </code></pre>