First of all, i tried to read other solutions for the same problem, but due my limited knowledge i was unable to make it work.
What I'm trying to make is a function that forcefully kills every process named notepad.exe using C#.
But I don't want it to kill or try to kill other users processes as well.
If it could perform as same as this taskill cmd command, it would be great!
taskkill /fi "username eq %username%" /im notepad.exe /f
So far i was only able to do this, that partially solves the problem, but will other users processes :
private void KillNotepad()
{
var procs = Process.GetProcessesByName("notepad");
foreach (var proc in procs)
{
proc.Kill();
}
}