Executing a file and capturing the output
Posted on 2004-08-14
This is really a two part question:
1.) How do I execute an executable file from a c# program? In c++ I could just use the ShellExecute windows API function call. I really don't want to use API function call I would rather use something within the .NET framework...but if I do have to use the ShellExecute API function call; how do I do that using C#?
2.) Assuming the executable that I am executing from step 1 is a console application or something that outputs strictly text; how can I capture this text. For instance how could I place it in a System.IO.TextReader. In C++ I would have to pipe the output to a stream. In C# is there something similar.
As much code examples would be extremely helpfull as I am new to C#...just recently converted from C++.