2010-03-29 3 views

ответ

5

Посмотрите на 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() 
+0

Привет DTB, Спасибо за Ваш ответ. Я думаю, что он работает хорошо. Единственное, что он выдает окно команд до окончания внешней команды. Как я могу подавить это окно? Спасибо –

+1

Я только что получил его: compiler.StartInfo.CreateNoWindow = True –

Смежные вопросы