title: writing to a file using java and command prompt
body: <p>when I run this command <code>ffmpeg -i "C:\user\test.wmv" &gt;C:\user\test.wmv_info.txt 2&gt;&amp;1</code> from command prompt it works but when I try to the same from java file by calling the command prompt it executes all right but does not writes to the file.</p>
  
  <p>Any idea why? </p>
  
  <p>my java code is:</p>
  
  <pre><code>public void getInfoThroughCommandLine(String sourceFilePath) {
      try {
  
          String infoFile = sourceFilePath+"_info.txt";
          String command = "ffmpeg -i \""
                  + sourceFilePath +"\" &gt;"+infoFile+" 2&gt;&amp;1";
  
          // Execute the command
          Process process = Runtime.getRuntime().exec("cmd.exe /c start " + command);
  
          logger.info("Executing getInfoThroughCommandLine command: " + command);
  
  
                      // Read the response
          BufferedReader input = new BufferedReader(new InputStreamReader(
                  p.getInputStream()));
          BufferedReader error = new BufferedReader(new InputStreamReader(
                  p.getErrorStream()));
  
          // Parse the input stream
          String line = input.readLine();
          System.out.println("ffmpeg execution of: " + sourceFilePath);
          while (line != null) {
              System.out.println("\t***" + line);
              line = input.readLine();
          }
  
          // Parse the error stream
          line = error.readLine();
          System.out.println("Error Stream: " + sourceFilePath);
          while (line != null) {
                          //do somthing
                      }
  
      } catch (Exception e) {
          System.err.println(e);
      }
  }
  </code></pre>