title: how to catch a standard output from my command line?
body: <p>I try to run a process.start() for command in command line, and try to get the output into string or some usefull locaiton. The output will consist of several rows ( like DIR command ). I read how to do it but it doesn' t work for me. It runs but then got into loop and does not stop.See below. any ideas?</p>
  
  <pre><code>        ProcessStartInfo myProcessStartInfo = new ProcessStartInfo("cmd.exe", 
                                                                    @" /k dir");
          Process myProcess = new Process();
          myProcess.StartInfo.RedirectStandardOutput = true;
          myProcess.StartInfo.UseShellExecute = false;
          myProcess.StartInfo.FileName = "cmd.exe";
          myProcess.StartInfo.Arguments = @" /k dir";
          myProcess.Start();         
  
          string ppp = myProcess.StandardOutput.ReadToEnd();
          myProcess.WaitForExit();
  </code></pre>