I am sure this question is answered out there somewhere, but I am not having much success with this.
I am seeking to have a long CMD.exe process to run, and show the live output to a Windows Form.
All the solutions I am finding all seem to have to wait for the process to complete, and then output is redirected text at the end.
I am not having any luck working out how to show the progress while it is running, and being notified when completed.
I have tried many variations, but not having any luck yet.
So simply looking to run this code below, and see progress on the WinForm, and then raise an event when the command is completed.
Process process = new Process();
process.StartInfo.FileName="cmd.exe";
process.StartInfo.Arguments=@"/C DIR C:\ /s";
I found a working solution using SetParent, MoveWindow, SetWindowLong functions from user32.dll, but I can't control the CMD Windows appearance.
Looking for a simple (elegant) way to achieve this result so I can see the progress, and control the position, fonts and colours as well.
Again, I know solutions are around, but finding this more complicated than what I would like.
Thanks for any suggestions.