我想知道,在visual basic 2008中,如何执行一个外部控制台(commandline)命令并在没有中间文件的帮助下获得其输出(以加快速度)?
看一看 ProcessStartInfo.RedirectStandardOutput 和 Process.StandardOutput .
例子:
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()