taskkill – kill pocesses under windows from command line

Found a useful windows command line function – “taskkill”. This is used to kill tasks or processes under windows from command line. The syntax is:

[code] taskkill /F /IM notepad.exe[/code]

Also noticed that this command sometimes does not work nice. It writes to the output that the task, whitich remains running, is killed. Comment this thread if you have some experience on this issue.

7 thoughts on “taskkill – kill pocesses under windows from command line

  1. nicolas

    taskkill does NOT kill the task. It sends a WM_CLOSE to the process’ main window, which is the same as clicking the X button. If program is hanged, or doesn’t have any window, this won’t work.

    Use taskkill /F /im program.exe (/F for Forced), this really kills the process. Same as killing it from task manager.

  2. aurimas.norkevicius Post author

    Thank you, Nicolas. One of my application uses this command to kill tasks and I’ve noticed that it some times fails to terminate the task. Your solution will help I guess…

  3. pokekid88

    I’m trying to kill sth on a local machine but taskkill got the following error..

    “Logon failure: Invalid username or bad password”

    Is there a need to logon using local machine??

  4. sam

    i’m trying to kill firefox as it keeps hanging, but although taskkill says success, firefox remains a process and hung.

  5. aurimas.norkevicius Post author

    It can bet that you have two processes “firefox” running one child and one parent … Child can be killed but parrent restarts it … You have to kill parent … In this case you have to use come sommand line tool to retrieve pids of the processes

  6. PctechJR

    It helps if you look up help in (taskkill /?) it brings up all the commands for taskkill, one that always works for me is: taskkill /f /im program.exe /t

Leave a Reply