For a project I am building a new front end for an old Batch script System. I have to use Windows XP and C# with .Net. I don’t want to touch this old Backend system as it’s crafted over the past Decade. So my Idea is to start the cmd.exe Program and execute the Bash script in there. For this I will use the “system” function in .Net.
But I also need to read the “Batch script commandline Output” back into my C# Program. I could redirect it into a file. But there has to be a way to get the Standard Output from CMD.exe in into my C# Program.
Thank you very much!
Your ways are good. But you only get the whole Output at the end. I wanted the output when the script was running. So here it is, first pretty much the same, but than I twised the output.
If you have problems look at:
http://msdn.microsoft.com/en-us/library/system.diagnostics.processstartinfo.aspx
Something is off, but whatever you get the idea…
The DoSomething is this function:
Hope this Helps