You want to end a process that’s currently running.
Find the process using Process.GetProcessesByName, and then terminate it using Process.CloseMainWindow or Process.Kill.
The Process class provides two methods for ending a process: CloseMainWindow and Kill. CloseMainWindow sends a close message to the main window of an application and is the equivalent of the user closing the window. CloseMainWindow is preferable to Kill because it allows an orderly shutdown. For example, an application such as Microsoft Word will prompt the user to save any open documents. However, CloseMainWindow might not end an application. Most applications will ask for user verification before exiting.
Kill, on the other hand, ...