How to get the path of current process ?

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

Guest

How do I find the full path where my current process is executed from?
System.Environment.CurrentDirectory and
System.IO.Directory.GetCurrentDirectory is not good enough because they may
be changed any many circumstance and not reflect the original location the
current process is started from.

Any Idea?
 
Ok, I found the how to:

System.Reflection.Assembly ass =
System.Reflection.Assembly.GetExecutingAssembly();
string fullProcessPath = ass.Location;
string desiredDir = Path.GetDirectoryName(fullProcessPath);
 
Hi,

In the Assembly class you have several properties you can use for this. take
a look at Location and/or CodeBase
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top