C # - redirected process - Console is different from CMD window

I have an application with Processthat uses the cmd program. The output of the process is redirected like this:

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); 

Then the output is written to the console using:

public void OnDataReceived(object sender, DataReceivedEventArgs e)
{
    if(e.Data != null)                                  
    {
        Console.WriteLine(e.Data);
    }
}

My problem is that Visual Studio prints the output, it is very different from the command line output. For example, I am 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)

Commandline ( ):
100% [===================================]

, . Visual Studio CMD?

Ps. .

+3
2

. , ( ).

0

, wget , . , .

, , wget [====, - . , , , :

  5% [=
 10% [==
 15% [===
 20% [====

... .

, --progress=bar .

+1

Source: https://habr.com/ru/post/1771286/


All Articles