Jump to content
Sign in to follow this  

Find the path of a exe files running the the handle/pid

Recommended Posts


Hello, I need to find the exe's path of a running exe file with the handle/pid of this file.


Share this post

Link to post
Share on other sites

Can't remember who wrote this function, sorry that I cannot give credit where credit is due. Just had it in my files for aid in making a program.

The function that your looking for:

;Gets Path via PID
Func _WinGetPath($PID="")
   $colItems = ""
   $objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\CIMV2")
   $colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_Process WHERE ProcessId = " & $PID, "WQL", _
         0x10 + 0x20)
   If IsObj($colItems) Then
      For $objItem In $colItems
         If $objItem.ExecutablePath Then Return $objItem.ExecutablePath

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.