I'm wondering, in Visual Basic 2008, how to execute an external console (commandline) command and get its output without help of an intermediate file (to speed up)?
1 Answer
Have a look at ProcessStartInfo.RedirectStandardOutput and Process.StandardOutput.
Example:
compiler.StartInfo.FileName = "csc.exe"
compiler.StartInfo.Arguments = "/r:System.dll /out:sample.exe stdstr.cs"
compiler.StartInfo.UseShellExecute = False
compiler.StartInfo.RedirectStandardOutput = True
compiler.Start()
Console.WriteLine(compiler.StandardOutput.ReadToEnd())
compiler.WaitForExit()