Hi. In C#, how do I check if, for example, calculator is running (calc.exe) in task manager process? and how do I end the calc.exe process? Thank you.

Very simple. Just loop through the processes list and check the name of the current process:

//don't forget: using System.Diagnostics;
            try
            {
                Process[] p = Process.GetProcesses();//system processes in an array
                for (int i = 0; i < p.Length; i++)
                {
                    
                    if (p[i].ProcessName == "calc")//checkcurrent process name
                    {
                        //we got it
                        MessageBox.Show("Calculator process found - we will kill it after you press ok");
                        p[i].Kill();//this is the process
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }

Their name does not contain the *.exe extension. Good luck :).
Clawsy.

If your problem is solved I'm glad for you and don't forget to mark the thread as solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.