Jump to content

Workingdir from a PID?


Recommended Posts

Hey, i know this can be done in liux by a cmdline, but is there any way to determine the workingdir of a process, by PID or something? I need to find the source of a process that may or may not exist. Problem the Process is named all the same but could be startet from different directories.

My current solution is to check all possible sources for a lock.txt which is written when the process is startet. But there might be a more 'nice' method of checking this out.

Link to comment
Share on other sites

Check out my Process Functions UDFs (in my signature) for a way to get the Current directory using API calls. There's probably also a way to do with WMI calls.

(function name: _ProcessUDGetStrings())

Link to comment
Share on other sites

Func checkpath($processname)
    $currentpath = ''
    $processhandle = _processopen($processname,0x0400)
    $processinfo = _ProcessGetPathname($processhandle)
    If Not @error Then $currentpath = $processinfo
    __PFCloseHandle($processhandle)
    If $currentpath = '' Then Return 0
EndFunc   ;==>checkpath

Yay! thnx mate :mellow:

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...