[python-win32] Query and remove all IEBrowsers

Tim Golden tim.golden at viacom-outdoor.co.uk
Fri Jan 6 09:37:55 CET 2006


[George Flaherty]
| 
| Is it possible with python/win32 to "query and remove" all 
| running internet explorers (ie browsers)?
| 
| I have an automation package that requires no existing 
| internet explorers to be running. So I would like to call a 
| python/win32 script to close out any ie browser windows, then 
| run the automation tools.

As far as I can see, this does what you want:
(uses the wmi module from http://timgolden.me.uk/python/wmi.html)

<code>
import wmi

c = wmi.WMI ()
for p in c.Win32_Process (Name="iexplore.exe"):
  print p.Caption
  p.Terminate ()

</code>

TJG

________________________________________________________________________
This e-mail has been scanned for all viruses by Star. 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