Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have the following code:

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);

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
177 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...