title: multiple command one by one in cmd.exe via c#
body: <p>I trying to run the following command in cmd.exe by c# code. </p>
  
  <ol>
  <li>mkdir myfolder</li>
  <li>cd myfolder</li>
  <li>git init</li>
  <li>git remote set-url origin <a href="https://gitlab.company.com/testgroup/server.git" rel="nofollow noreferrer">https://gitlab.company.com/testgroup/server.git</a></li>
  <li>git fetch --dry-run</li>
  <li>cd ..</li>
  <li>rmdir myfolder</li>
  </ol>
  
  <p>I don't know how to pass all the arguments in single <code>Process.Start();</code>. After run the 4th command I will take the output <code>string</code> and do some operation with that <code>string</code>.</p>
  
  <p>I tried like this  </p>
  
  <pre><code>        const string strCmdText = "/C mkdir myfolder&amp; cd myfolder&amp; git init &amp; git remote set-url origin https://gitlab.company.com/project.git &amp; git fetch --dry-run &amp; cd .. &amp; rmdir myfolder";
          Process.Start("CMD.exe", strCmdText);
  </code></pre>
  
  <p>Above command works properly. But I do not know how to get the execution text from <code>cmd.exe</code>. The text which I want is shown in below image.</p>
  
  <p><a href="https://i.stack.imgur.com/UO7jQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UO7jQ.jpg" alt="The text I want"></a></p>
  
  <p>I used below code to get the output <code>string</code>. But at the line of reading the output(<code>string output = cmd.StandardOutput.ReadToEnd();</code>), the execution stopped. I means it will not go to next line also it will not terminate the program. Simply show the lack screen.</p>
  
  <pre><code>        Process cmd = new Process();
          cmd.StartInfo.FileName = "cmd.exe";
          cmd.StartInfo.Arguments = "/C mkdir myfolder&amp; cd myfolder&amp; git init &amp; git remote set-url origin https://gitlab.company.com/project.git &amp; git fetch --dry-run &amp; cd .. &amp; rmdir myfolder";
          cmd.StartInfo.UseShellExecute = false;
          cmd.StartInfo.RedirectStandardOutput = true;
          cmd.StartInfo.RedirectStandardError = true;
          cmd.Start();
          string output = cmd.StandardOutput.ReadToEnd();
          Console.WriteLine(output);
  </code></pre>
  
  <p>How do I get the output <code>string</code>?</p>