Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to end a process using C# [duplicate]

I am attempting to end a process in C#, the current code I have is this:

foreach (var process in Process.GetProcessesByName("chromedriver.exe"))
{
    process.Kill();
}

In Task manager, under processes the Image Name:

chromedriver.exe *32

I am not ending the process... What is needed? or is this even possible?

like image 489
ism Avatar asked Jun 14 '26 11:06

ism


1 Answers

'.exe' is not part of the process name, you just want:

foreach (var process in Process.GetProcessesByName("chromedriver"))
like image 152
paul Avatar answered Jun 16 '26 12:06

paul