Jump to content

How to get the path where a process executed from?


xManh
 Share

Recommended Posts

Originally pilfered from gafrost, modified slightly by me.

$dir = _GetPIDPath('your.exe')

MsgBox(0, '', $dir)

Func _GetPIDPath($exe)
    $pid = ProcessExists($exe)
    $objWMIService = ObjGet('winmgmts:\\localhost\root\CIMV2')
    $colItems = $objWMIService.ExecQuery ('SELECT * FROM Win32_Process WHERE ProcessId = ' & $pid, 'WQL', 0x10 + 0x20)
    For $objItem In $colItems
        If $objItem.ExecutablePath Then Return $objItem.ExecutablePath
    Next
EndFunc

edit - because I edit everything at least once.

Edited by xcal
Link to comment
Share on other sites

Originally pilfered from gafrost, modified slightly by me.

$dir = _GetPIDPath('your.exe')

MsgBox(0, '', $dir)

Func _GetPIDPath($exe)
    $pid = ProcessExists($exe)
    $objWMIService = ObjGet('winmgmts:\\localhost\root\CIMV2')
    $colItems = $objWMIService.ExecQuery ('SELECT * FROM Win32_Process WHERE ProcessId = ' & $pid, 'WQL', 0x10 + 0x20)
    For $objItem In $colItems
        If $objItem.ExecutablePath Then Return $objItem.ExecutablePath
    Next
EndFunc

edit - because I edit everything at least once.

that's cool....

The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...