Mehrdad
Mehrdad

Reputation: 2116

Restart a process

I want to restart a program.
I've found the process and have called Kill method, then i've runned it again:
process.Kill();
process.Start();

It stops but doesn't start.
Also if I put Exited event it never fires.
What's the problem?

Upvotes: 4

Views: 6223

Answers (1)

gregwhitaker
gregwhitaker

Reputation: 13410

Process.Kill() is asynchronous. You need to call Process.WaitForExit() after calling kill.

Upvotes: 8

Related Questions