title: save the output of command prompt to a file
body: <p>I am trying to execute a series of commands in a <code>cmd.exe</code> shell from within Java and pipe the output of these commands to a file. Here is the code I've written:</p>
  
  <pre><code>Process process = rt.exec("cmd /c start cmd.exe /K \"cd C:\\Temenos\\ModelBank-R15-TAFJ\\T24\\Env\\MB\\Agents &amp;&amp; C: &amp;&amp; Environment.bat &amp;&amp; DBTools JQL LIST-ITEM F.SPF \"&gt;D:\\test.txt \"");
  </code></pre>
  
  <p>If I run <code>DBTools JQL LIST-ITEM F.SPF</code>, I can see output on the console, but I want to save the output to a file. When I add <code>&gt; D:\\test.txt</code>, I see that a <code>test.txt</code> file is created in <code>D:\</code>, but it is blank.</p>
  
  <p>Please if anyone can help me out in this, as this very crucial for my project.</p>