Is there any way I can get a process that is running by a partial name, like what happens with like
in a SQL
search?
Why I ask this: I have a team viewer
custom here for the company. The problem is that if I happen to have a process named "Team Viewer 10", I can kill > it. But if the client has a newer or earlier version, the process name is not the same ... So I would not have kill .
Then how would I get the name of the process partially and if found, kill? That is, if I find a process with the name "Team Viewer" already trigger the code to kill this process?
What I have so far:
//buscando o nome do processo
System.Diagnostics.Process[] processoTv = System.Diagnostics.Process.GetProcessesByName(teamViewer);
//verificando se existe o processo em execução e se houver finaliza
if (processoTv.Length > 0)
foreach (System.Diagnostics.Process processoItem in processoTv)
processoItem.Kill();
Where teamViewer
is equal to "Team Viewer 10".
Is there any way to do this?