Sign in to follow this  
Followers 0
Fainth

Workingdir from a PID?

4 posts in this topic

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.

Share this post


Link to post
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())

Share this post


Link to post
Share on other sites

Thank you for the lead, will check it out, and see if i can work with it :mellow:

Share this post


Link to post
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:

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  
Followers 0