FW: [python-win32] killing win32 process
Tim Golden
tim.golden at viacom-outdoor.co.uk
Tue Oct 14 12:19:51 EDT 2003
> -----Original Message-----
> From: FOURNIER Cedric [mailto:cedric.fournier at sescoi.fr]
> Sent: 14 October 2003 12:08
> To: python-win32 at python.org
> Subject: [python-win32] killing win32 process
> I am under win2000 and python 2.3
> I have a win32 executable
> I know its name
>
> Can anyone explain me use of win32 api to kill this process.
I'm sure there are other ways, but I'd use WMI:
Get the WMI module from
http://tgolden.sc.sabren.com/python/wmi.html
Either copy the "Create and then destroy a new notepad process"
example from the cookbook page (note to self: put internal
anchors on that page)
http://tgolden.sc.sabren.com/python/wmi_cookbook.html
or, if you need to have created it with popen, do something
like this:
c = wmi.WMI ()
for process in c.Win32_Process (Name='name of process'):
process.Terminate ()
where 'name of process' obviously has to be replaced by
the name of the process you're running.
HTH
TJG
[Sorry - I always forget to send back to the group. Tim]
________________________________________________________________________
This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk
________________________________________________________________________
More information about the Python-win32
mailing list