title: Calling cmd.exe using Process in C# hanging
body: <p>I am trying to get the standard out from cmd.exe (testing "DIR" command), and put it into a text box. However, whenever I start the process the program hangs (no button presses).</p>
  
  <pre><code>private void cmd_test()
  {
      Process pr = new Process()
      {
          StartInfo = {
              FileName = "cmd.exe",
              UseShellExecute = true,
              CreateNoWindow = true,
              RedirectStandardOutput = true,
              RedirectStandardInput = true,
              RedirectStandardError = true,
          }
      };
  
      pr.Start();
      pr.StandardInput.WriteLine("DIR");
      TextBox1.Text = pr.StandardOutput.ReadToEnd();
  }
  </code></pre>
  
  <p>I have also tried <code>Arguments = "DIR"</code> in the StartInfo block instead of WriteLine.</p>
  
  <p>How do I properly send a command to cmd.exe, without it hanging?</p>