alias isprocess {
if ($isid) {
if ($2 !isnum 1-) { tokenize 32 $$1 1 }
var %a = a $+ $ticks, %b = b $+ $ticks, %c = c $+ $ticks, %i = 1
.comopen %a WbemScripting.SWbemLocator
if ($com(%a)) {
.comclose %a $com(%a,ConnectServer,3,dispatch* %b)
if ($com(%b)) {
.comclose %b $com(%b,ExecQuery,3,string,SELECT Name FROM Win32_Process WHERE Name=" $+ $1",dispatch* %c)
if ($com(%c)) {
if ($comval(%c,$2,Name) == $1) {
.comclose %c
return $true
}
}
}
}
if ($com(%a)) { .comclose %a }
if ($com(%b)) { .comclose %b }
if ($com(%c)) { .comclose %c }
return $false
}
}