进程 waitForExit() 不起作用 [英] Process waitForExit() doesn't work
问题描述
我有以下代码:
Process p = new Process();
p.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + "\\unRAR.exe";
p.StartInfo.Arguments = @"e c:\appData.rar c:\folderek\";
p.Start();
p.WaitForExit(9000);
我希望在提取文件后不关闭窗口(unRAR.exe
提取它们).WaitForExit(9000)
似乎不起作用.我阅读了数十个网站,但仍然找不到任何解决方案.
I would like the window not to close after extracting files (unRAR.exe
extracts them). WaitForExit(9000)
seems not to work. I read dozens of sites and still can't find any solution.
推荐答案
http://msdn.microsoft.com/en-us/library/fb4aw7b8.aspx 阅读这篇文章告诉您 WaitForExit()
不会使程序保持活动状态,它只是等待相关程序退出.如果相关程序(此处为 unzip.exe)退出,您将无法阻止 unzip.exe
程序退出.
http://msdn.microsoft.com/en-us/library/fb4aw7b8.aspx reading this article tells you that the WaitForExit()
does not keep the program alive, it just waits for the associated program to exit. If the associated program(unzip.exe here) exits, you will not be able to stop the unzip.exe
program from exiting.
这篇关于进程 waitForExit() 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!