hi, here is my script:<br><br>import win32con<br>import time<br>import wmi<br>c = wmi.WMI()<br>for process in c.Win32_Process(name = &quot;notepad.exe&quot;):<br>&nbsp;&nbsp;&nbsp; print process.ProcessId, process.Name<br>&nbsp;&nbsp;&nbsp; process.Terminate

()<br><br>when I have only one notepad.exe process in my system,&nbsp; this works fine,<br>but
when I have more than one notepad.exe , after terminal the first
notepad.exe, the Terminate() for the second notepad.exe process will
generate the following error:
<br><br>3156 notepad.exe<br>6100 notepad.exe<br>Traceback (most recent call last):<br>&nbsp; File &quot;F:\thunder\python\program\wmi<div id="mb_0">\create_terminal_notepad.py&quot;, line 16, in<br>module&gt;<br>&nbsp;&nbsp;&nbsp; process.Terminate
()<br>&nbsp; File &quot;C:\Python25\Lib\site-packages\wmi.py&quot;, line 376, in __call__
<br>&nbsp;&nbsp;&nbsp; handle_com_error (error_info)<br>&nbsp; File &quot;C:\Python25\Lib\site-packages\wmi.py&quot;, line 188, in handle_com_error<br>&nbsp;&nbsp;&nbsp; raise x_wmi, &quot;\n&quot;.join (exception_string)<br>wmi.x_wmi: -0x7ffdfff7 - 发生意外(ps: exception happened)。
<br>&nbsp; Error in: SWbemObjectEx<br>&nbsp; -0x7ffbeffe - 找不到(ps:Can not found)<br><br><br>I don&#39;t know why this happend, is there somebody could give me a hand?</div>