Close application

How would i go about closing another .exe that is currently running, it's in the processes list. But what code would i use to close that .exe

Answer this question

Close application

  • patel_mitesh

    I figured it out and it worked. Thanks
  • TMacPhail

    Hi,

    Here is a code snippet in C# that does it. You need to import the namespace System.Diagnostics. The sample terminates an instance of notepad if it is running.


    Process[] arrProcesses = Process.GetProcessesByName("notepad");
    if (arrProcesses.Length > 0) 
                arrProcesses[0].Kill();


     



    Regards,
    Vikram



  • Close application