How to get the full path of a running process

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
How can I obtain the full path for a running process without using WMI? I've tried to use the Process.StartInfo.WorkingDirectory but it's not valid since the process is already running.

Thanks,
 
Christopher,

are you looking for Application.ExecutablePath Property or something else?

HTH
Alex

Christopher Attard said:
Hi,
How can I obtain the full path for a running process without using
WMI? I've tried to use the Process.StartInfo.WorkingDirectory but it's not
valid since the process is already running.
 
System.Windows.Forms.ApplicationPath

[..or..]

System.Reflection.Assembly.GetEntryAssembly().Location

Chris
 
I'm searching for the WorkingDirectory of all the currently-running
processes on a machine.

Chris
 
Environment.CurrentDirectory

sorry for the confusion, I believe that's what you're looking for.

Chris

Christopher Attard said:
I'm searching for the WorkingDirectory of all the currently-running
processes on a machine.

Chris

Chris said:
System.Windows.Forms.ApplicationPath

[..or..]

System.Reflection.Assembly.GetEntryAssembly().Location

Chris
 
Hi,

I think that WMI is the only way then , but I'm not 100% sure of it. Do a
google search

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

Christopher Attard said:
I'm searching for the WorkingDirectory of all the currently-running
processes on a machine.

Chris

Chris said:
System.Windows.Forms.ApplicationPath

[..or..]

System.Reflection.Assembly.GetEntryAssembly().Location

Chris
 
Take a look also at ProcessModule class and its FileName property. You can
obtain it with Process.MainModule property.

HTH
Alex

Chris said:
Environment.CurrentDirectory

sorry for the confusion, I believe that's what you're looking for.

Chris

Christopher Attard said:
I'm searching for the WorkingDirectory of all the currently-running
processes on a machine.

Chris

Chris said:
System.Windows.Forms.ApplicationPath

[..or..]

System.Reflection.Assembly.GetEntryAssembly().Location

Chris
 
AlexS, thanks for your solution. Infact Process.MainModule does what I've
been looking for.

Chris

AlexS said:
Take a look also at ProcessModule class and its FileName property. You can
obtain it with Process.MainModule property.

HTH
Alex

Chris said:
Environment.CurrentDirectory

sorry for the confusion, I believe that's what you're looking for.

Chris

Christopher Attard said:
I'm searching for the WorkingDirectory of all the currently-running
processes on a machine.

Chris

System.Windows.Forms.ApplicationPath

[..or..]

System.Reflection.Assembly.GetEntryAssembly().Location

Chris
 
Back
Top