Search code examples
c#command-linec#-4.0taskkill

Periodically shut down a program


I want to kill an executable of a game named KnightOnline and deny user to run it. I'm using:

Process.Start("taskkill.exe", "/f /im kol.exe");

but it's showing a command window. How can I hide the command window, or is there another professional but infamous method to deny an unwanted program?

EDIT: I edited hosts and blocked login page of the game as a solution.


Solution

  • You can use Process.Kill to kill another process:

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