11

I am able to kill running processes which show up in the task manager but there are some games like KnightOnline and Metin2 that don't show up in task manager and so I can't kill them. I've been searcing for a solution but couldn't find. This is an internet cafe software and I just want to close all programs and games when a customer leaves so that the new customer will have a fresh desktop.

As windows automaticly closes everything, I thought of ending the session and reloging but that doesn't seem to be easy and not the best way.

Waiting for your valuable comments

1

4 Answers 4

13

Use ProcessExplorer - http://technet.microsoft.com/en-us/sysinternals/bb896653 to check all processes and close what you want. It should show you every application on every account -if you have administrator rights of course.

To kill it programatically check this post: https://stackoverflow.com/questions/1642231/how-to-kill-a-c-process

When you don't know name of process, but you know name of executable that is run on your computer ( C:...\Metin.exe) then you can iterate through all processes and search for process that in list of loaded modules (Modules property) has module with name of your executable (FileName property in ProcessModule class) . Maybe it helps.

7
  • Actually, I'm looking for a way to do it by code
    – teknolog
    Apr 7, 2011 at 19:41
  • So describe your needs in question...
    – Korin - Marek K.
    Apr 7, 2011 at 19:44
  • my question was "Kill process that doesn't show up in task manager" What's wrong with it? It already explains
    – teknolog
    Apr 7, 2011 at 19:46
  • "Hi, I am able to kill running processes which show up in the task manager but there are some games like KnightOnline and Metin2 that don't show up in task manager and so I can't kill them" - doeas it tell us that you want to kill it by code? It only describe that you have problems with task manager.
    – Korin - Marek K.
    Apr 7, 2011 at 19:47
  • okay sorry, as I mentioned that it was an internet cafe software and put the c#4 tag below, I thought you could undestand that it was a programming question
    – teknolog
    Apr 7, 2011 at 19:49
2

If you can't find your application in the Applications tab then in the Task Manager switch to the second tab "Processes" find your desired application process then press "End Process", normally all processes have names similar to their applications, see the image below:

Steps

1
  • 1
    He's talking about hidden processes, which means they can't be found there.
    – Pacerier
    Jun 8, 2015 at 19:50
2

From a command line do

"tasklist | more"

pay attention to the PID (for instance 123)

to kill the item do

"taskkill /f /pid 123"

The benefit is that these commands also work on remote systems.

"tasklist /s <systemname> /u <domain>\<user>"

same for taskkill

3
  • He's talking about hidden processes, which means they can't be found there.
    – Pacerier
    Jun 8, 2015 at 19:51
  • Was using Visual Studio to debug my application when it crashed. Fixed the bug and tried to rebuild, but it couldn't complete because the application was still in use. However, the application did not show up in Task Manager. Tried restarting Visual Studio, but that didn't work either. Visual Studio reported the PID, so I was able to kill the process via taskkill. Just be sure to run the Command Prompt as an administrator.
    – Matt Davis
    Aug 28, 2020 at 23:50
  • @MattDavis I have run into a similar situation as well -- in my case the process started using System.Diagnostics.Process is not terminated. However I do notice that if I close task manager and reopen, that process is shown in the list.
    – Zhe
    Sep 3, 2022 at 10:09
1

There is Kill method in Process. You may use it in such way:

var procs = System.Diagnostics.Process.GetProcesses(); // Get all processes in the system
procs[0].Kill();

There is also GetProcessesByName method with help of wich you can obtain pricesses by their names:

var procs = System.Diagnostics.Process.GetProcessesByName("firefox");
2
  • 1
    thanks but it doesn't help me with hidden processes
    – teknolog
    Apr 7, 2011 at 20:51
  • Are you sure that your processes is really hidden? Is it true that processes isnt visible even if you press "Show processes from all users"? It also may be that KnightOnline and Metin2 have process names different from their program names
    – Anton Semenov
    Apr 8, 2011 at 7:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .