/ Published in: C#
I built a middleware app to fire from an ERP addon, as part of the trigger process my app needed to close the ERP addon to reduce errors during a re-run of the event. I used this to kill the process.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
public static void stopNamedProcess(string name) { foreach (Process p in System.Diagnostics.Process.GetProcessesByName(name)) { try { p.Kill(); p.WaitForExit(); } catch (Exception exp) { Console.WriteLine(exp.Message); System.Diagnostics.EventLog.WriteEntry("AlchemySearch:KillProcess", exp.Message, System.Diagnostics.EventLogEntryType.Error); } } }