tags:

views:

303

answers:

1

Hi All

I have a GUI program, which would call a cmd in this GUI program. In my case, the GUI call the robocopy to copy the file to a file server.And I want to show the progress in the GUI. So how can I get the output of the robocopy and display it on my GUI.

Best Regards, Yongwei Xing

+3  A: 

Use the StandardOutput stream:

process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;

// ...
// read from process.StandardOutput

Alternatively, rather than reading from StandardOutput directly, you can call BeginOutputReadLine passing a callback that will tell you whenever a new line is outputted.

Mehrdad Afshari