Skip to content

Instantly share code, notes, and snippets.

@luizpestana
Created December 8, 2016 11:00
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save luizpestana/413a842e779e5915ee88bef5569f79a2 to your computer and use it in GitHub Desktop.
Run only one process .Net
foreach (Process proc in Process.GetProcesses())
if ((proc.ProcessName == Path.GetFileNameWithoutExtension(Application.ExecutablePath)) && (proc.Id != Process.GetCurrentProcess().Id))
proc.Kill();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment