I have an application with a Process
that use a cmd program. The Process's output is redirect like so:
pr.StartInfo.RedirectStandardOutput = true;
pr.StartInfo.UseShellExecute = false;
pr.StartInfo.CreateNoWindow = true;
pr.EnableRaisingEvents = true
pr.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
pr.OutputDataReceived += new DataReceivedEventHandler(OnDataReceived);
pr.ErrorDataReceived += new DataReceivedEventHandler(OnDataReceived);
The output is then written to the console using:
public void OnDataReceived(object sender, DataReceivedEventArgs e)
{
if(e.Data != null)
{
Console.WriteLine(e.Data);
}
}
My problem is the Visual Studio prints the output, it's very different to the commandline output. For example, I'm trying to extract data from the output to see how much work has been done. My application output:
0K .......... .......... .......... .......... .......... 1% (null)
50K .......... .......... .......... .......... .......... 2% (null)
100K .......... .......... .......... .......... .......... 3% (null)
150K .......... .......... .......... .......... .......... 5% (null)
The original Commandline program output (progress bar and percentage accumulates as time goes on):
100%[===================================]
It may not seem a big difference, but for what I'm trying to achieve it is. Why isn't Visual Studio output exactly the same as the CMD out?
Ps. Arguments are the same in both examples.