maysam
maysam

Reputation: 519

how start many process(own program) when process is singleton in C#

i have loop and in loop my program spawn new process and new process is singleton so other process cant start

foreach (var i in files)
{
    System.Diagnostics.Process.Start("c:\\Telock\\Telock.exe", " -S" + i.ToString());

}

how start 2 after 1 finish and ...

Upvotes: 1

Views: 294

Answers (1)

jgauffin
jgauffin

Reputation: 101140

Why don't you look up Process class in MSDN (after all, you ARE using it)? If you had done that, you would have found the WaitForExit method.

foreach (var filename in files)
{
    Process.Start("c:\\Telock\\Telock.exe", " -S" + filename.ToString()).WaitForExit();
}

Take for habit to use more descriptive variable names (i doesn't really say anything, especially not for a filename).

Upvotes: 1

Related Questions