--output (or -o) writes the downloaded content into the given file (instead of writing it into stdout). The rest of cURL's output (progress meter, error messages, verbose mode etc.) is still written into stderr, which is shown in the terminal. https://en.wikipedia.org/wiki/Standard_streams
This means that you can only see the output of the HTML in C# with OutputDataReceived
but not the output made by the verbose mode.
This code in a running console application, prints all the verbose info to the console without writing it manually with Console.WriteLine()
:
System.Diagnostics.Process process = new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo();
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
startInfo.FileName = @"C:\Windows\System32\curl.exe";
startInfo.Arguments = @"https://vi.stackexchange.com/ -vs";
startInfo.RedirectStandardOutput = true;
process.StartInfo = startInfo;
process.Start();
You could save the output of the verbose mode to a txt file with curl through the help of a bat in this way:
curl https://vi.stackexchange.com/ -vs >curl-output.txt 2>&1
Or you could read the StandardError stream with ErrorDataReceived.
I would recommend to use the HttpWebRequest as shown on this question instead of using curl to do a request as a Process, unless you have a specific reason.