[ create a new paste ] login | about

Link: http://codepad.org/kK1CbVwI    [ raw code | fork ]

Python, pasted on Nov 19:
1
2
3
4
5
6
7
8
9
10
11
12
13
import win32api
import win32com.client

target = "thunderbird"
wmi = win32com.client.GetObject('winmgmts:')
query = 'select * from Win32_Process where name like "%%%s%%"' % target
procs = wmi.ExecQuery(query)

if len(procs) <= 2:
  for proc in procs:
    handle = win32api.OpenProcess(1, False, proc.Properties_('ProcessID').Value)
    win32api.TerminateProcess(handle, -1)
    win32api.CloseHandle(handle)


Create a new paste based on this one


Comments: