我在我的C#窗体应用程序中运行了这个代码:
string ExecutableFilePath = @"Scripts.bat";
string Arguments = @"";
if (File.Exists(ExecutableFilePath )) {
System.Diagnostics.Process.Start(ExecutableFilePath , Arguments);
}
当程序运行时,我能看到命令行窗口直到程序完成。
有没有一种方法可以在不显示给用户的情况下运行程序?
Process.WaitForExit()
将会阻止当前线程,直到该进程退出。 - Blam