【发布时间】:2013-10-08 19:01:15
【问题描述】:
问题是 WaitForExit 没有等到批处理文件退出。它几乎马上就回来了。
我正在按如下方式启动我的批处理文件:
ProcessStartInfo startInfo = new ProcessStartInfo(batchFile);
startInfo.UseShellExecute = true;
startInfo.Arguments = arguments;
using (Process p = Process.Start(startInfo))
{
p.WaitForExit();
}
我尝试了使用和不使用UseShellExecute。
【问题讨论】:
-
This answer 可能会有所帮助。
-
如果 WaitForExit() 不起作用,请尝试关注 this
-
那也没用。这个批处理文件一定是独一无二的。批处理文件会调用其他进程,但会等到它们全部退出后再返回。
标签: c# .net batch-file