title: How to use process class in c#?
body: <p>I use this code to run some cmd commands:</p>
  
  <pre><code>Process.Start("cmd.exe", "/C vpncli.exe -s &lt; data.dat &amp; vpncli.exe status " +
              "&gt; C:\\BicoinMiningProject\\BitcoinCloudMiningBypassApp\\BitcoinMiningProject" +
              "\\BitcoinCloudMiningBypassApp\\bin\\Debug\\VPN_Status.txt");
  </code></pre>
  
  <p>this works fine. but I need to use it like this:</p>
  
  <pre><code>using (var pro = new Process())
          {
              pro.StartInfo.WorkingDirectory = "C:\\Windows\\System32";
              pro.StartInfo.FileName = "cmd.exe";
              pro.StartInfo.CreateNoWindow = false;
              pro.StartInfo.RedirectStandardInput = true;
              pro.StartInfo.RedirectStandardOutput = false;
              pro.StartInfo.UseShellExecute = false;
              pro.StartInfo.Arguments = "/C vpncli.exe -s &lt; data.dat &amp; vpncli.exe status " +
                  "&gt; C:\\BicoinMiningProject\\BitcoinCloudMiningBypassApp\\BitcoinMiningProject" +
                  "\\BitcoinCloudMiningBypassApp\\bin\\Debug\\VPN_Status.txt";
              pro.Start();
              pro.StandardInput.Flush();
              pro.StandardInput.Close();
              pro.WaitForExit();
  
          }
  </code></pre>
  
  <p>because I need to wait for finishing the process before continue.</p>
  
  <p>this is not working. the cmd is opened but immediately close before running any command.</p>
  
  <p>Can anybody help me with this?</p>