I was looking for a way to simulate python's os.kill() in windows.Finally ended up with the following code. I tried using win32api also.

handle = subprocess.Popen("someprocess here", shell=False)

subprocess.Popen("taskkill /F /T /PID %i"%handle.pid , shell=True)

Comments:

[Trackback] While checking some facts for my previous post “how to find a process by name in Windows using Python” I came across a post about “how to kill a process in Windows using Python“.  I realize I have code for an alternate approach...

Posted by metazin on August 10, 2008 at 08:06 AM IST #

Hi,

I posted an alternate method...

http://metazin.wordpress.com/2008/08/09/how-to-kill-a-process-in-windows-using-python/

Thought it might be useful for you.

Posted by metazin on August 10, 2008 at 08:11 AM IST #

I ended up doing

import os
os.system("taskkill /im NameOfTheExe.exe /f")

Posted by Francis Cloutier on May 07, 2009 at 12:10 AM IST #

Post a Comment:
  • HTML Syntax: NOT allowed

This blog copyright 2009 by rajkumarsrinivas