I’ve a small C# installer application and I want to kill a process. Are there any advantages / differences in using
Process[] procs = Process.GetProcessesByName("[taskname]");
foreach (Process p in procs) { p.Kill(); }
vs
Process.Start("taskkill", "/F /IM [taskname].exe");
I read somewhere that using “taskkill” is only available in XP(and up), so would that make Process.Kill() the safer option?
Process.Killis prefered, because you are not starting another process as you do, when you starttaskkillto kill the process. It is just a lot of useless overhead.