title: How to create a C# application that opens "cmd.exe" in another window?
body: <p><strong>What I'd like to Do</strong></p>
  
  <p>I'd like to create a simple C# application that creates a <code>Process</code> object (the application's child process) that runs <code>cmd.exe</code> and, inside that shell, execute the command <code>echo "Hello World!"</code> (or whatever arbitrary string I specified before compiling the application). The C# application, when built and ran, creates and leave the shell in this state:</p>
  
  <p><a href="https://i.stack.imgur.com/AWTJI.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AWTJI.jpg" alt="Desired Window"></a></p>
  
  <p><strong>Attempts</strong></p>
  
  <p>I've searched stackoverflow and MSDN for examples but it's difficult to find the right options to set for <code>Process</code>, <code>ProcessStartInfo</code>. In particular, I tried: </p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Diagnostics;
  using System.Linq;
  using System.Text;
  using System.Threading.Tasks;
  
  namespace ConsoleApp1
  {
      class Program
      {
          static void Main(string[] args)
          {
              /*
              System.Diagnostics.Process process = new System.Diagnostics.Process();
              System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
              startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
              startInfo.FileName = "cmd.exe";
              startInfo.Arguments = "echo helloworld!";
              string strCmdText;
              process.StartInfo = startInfo;
              process.Start();
              */
  
  
              var proc = new Process
              {
                  StartInfo = new ProcessStartInfo
                  {
                      FileName = @"cmd.exe", // iexplorer.exe opened up ie!
                      Arguments = "",
                      UseShellExecute = false,
                      RedirectStandardOutput = true,
                      CreateNoWindow = false,
                      WorkingDirectory = @"C:\Users\mtran\Desktop\ConsoleApp1", 
                      WindowStyle = ProcessWindowStyle.Normal
  
                  }
              };
              proc.Start();
          }
      }
  }
  </code></pre>
  
  <p>but either second cmd window (for the child process) never appears (if I set <code>RedirectStandardOutput = false</code>)or the output of from the child process gets written to the parent's cmd window. </p>