且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在WPF应用程序中运行其他控制台进程之前,如何等待控制台进程完成?

更新时间:2023-10-20 15:40:10

假定您正在使用Process类来执行和捕获控制台的输出,则可以使用

Assuming you are using Process class to execute and capture output for console, you can use Process.WaitForExit method. It will block the current thread till the process finish the execution. There is another overload that can block the current thread till the process finishes or specified timeout period elapsed.