|
发表于 2008-8-19 22:20:07
|
显示全部楼层
根据文件路径关闭进程
ProcessClosePath("d:\\notepad.exe")
Func ProcessClosePath($Path)
Local $wbemFlagReturnImmediately
Local $wbemFlagForwardOnly
Local $strComputer,$objWMIService
Local $colItems,$objItem
$strComputer = "localhost"
$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Process Where ExecutablePath="'&$Path&'"', "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj($colItems) then
For $objItem In $colItems
$objItem.Terminate()
Next
Else
SetError(1)
Endif
EndFunc |
|