Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Text
Posted by: userc865b
Added: Dec 13, 2017 9:58 PM
Views: 6
Tags: au3
get windows processes you can set where Name='Appname.exe' in the select clause!
  1. $aProcess = ProcessList()
  2. $oWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & @ComputerName & "\root\cimv2")
  3.  
  4. If IsObj($oWMI) Then
  5.     $colProcs = $oWMI.ExecQuery("select * from win32_process")
  6.     If IsObj($colProcs) Then
  7.         For $oProc In $colProcs
  8.             $iPid = $oProc.ProcessId
  9.            
  10.            
  11.             For $i = 1 To $aProcess[0][0]
  12.                 If $aProcess[$i][1] = $iPid Then
  13.                     ConsoleWrite($aProcess[$i][0] & @TAB & $aProcess[$i][1] & @TAB & $oProc.ExecutablePath & @CRLF)
  14.                     ExitLoop
  15.                 EndIf
  16.             Next
  17.         Next
  18.     EndIf  
  19. EndIf