Problem
A Batch File should be executed and the output processed line by line. This is especially useful when you want to generate line break treatments.
Ansatz – Approach
The usage of a stream reader helps to process the output line by line.
Solution – Lösung
Process p = new Process();
// Redirect the output stream of the child process.
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.FileName = "D:\\doors_stats\\whatschanged.bat";
p.Start();
StreamReader sr = p.StandardOutput;
string output = "";
while (!sr.EndOfStream)
{
// Do s.th. with the received line (i.e. concate)
output += sr.ReadLine() + "\n\n<br/>";
}