title: C# .net i need to record the output of the file.?
body: <p>i have this program i need to make, where it runs a bat file. i got that far, so when i click the button it opens the bat. but 3 problems i encountered i have been trying to resolve for a few days now, the problem is that i need to get the output of the .bat and display it in a textbox, i got that, but it only displays the first and least line... then i need to run the .bat in the background. so you don't see the window. then i also need to be able to hit a second button to close it. the bat is a constant update, lets just say it reads a number then 5 seconds later adds 1 to that number and displays it again. and does this over and over till you close it. that would be a simple description of this</p>
  
  <pre><code>Process p = new Process();
  p.StartInfo.UseShellExecute = false;
  p.StartInfo.RedirectStandardOutput = true;
  p.StartInfo.FileName = "C:\\Users/jwoow/Desktop/Server/run.bat";
  p.Start();                    
  string output = p.StandardOutput.ReadToEnd();
  this.RunResults.Text = output;
  p.WaitForExit();
  </code></pre>