473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to get the path of current process ?

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?
----------
Thanks
Sharon
May 10 '06 #1
2 13556
Ok, I found the how to:

System.Reflection.Assembly ass =
System.Reflection.Assembly.GetExecutingAssembly();
string fullProcessPath = ass.Location;
string desiredDir = Path.GetDirectoryName(fullProcessPath);
May 10 '06 #2
Hi,

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

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Sharon" <Sh*****@newsgroups.nospam> wrote in message
news:AF**********************************@microsof t.com...
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?
----------
Thanks
Sharon

May 10 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Theerachet Pratoommanee | last post by:
This is error message I've got. Any suggestion would be appreciated. Server Error in '/WebDirectory' Application. ----------------------------------------------------------------------------...
70
by: Michael Hoffman | last post by:
Many of you are familiar with Jason Orendorff's path module <http://www.jorendorff.com/articles/python/path/>, which is frequently recommended here on c.l.p. I submitted an RFE to add it to the...
11
by: kk | last post by:
Can any function tell the compiled program executing path? after using the program to open a file from MFC dialog box, the path changes. thks in advance.
0
by: nic | last post by:
What is the best place to retrieve the current path of the aspx page being viewed? I want to store the current page path so after I perform some process I can return the user to where they were. ...
10
by: mirandacascade | last post by:
O/S: Win2K Vsn of Python:2.4 Based on a search of other posts in this group, it appears as though os.environ is one way to obtain the PATH environment variable. My questions: 1) is it...
3
by: David Thielen | last post by:
Hi; I created a virtual directory in IIS 6.0 and my asp.net app runs fine. But when it tries to write a file I get: Access to the path is denied. - C:\Inetpub\wwwroot\RunReportASP\images ...
1
by: André | last post by:
I'm attempting to override a wxHtmlWindow method in order to pre-process the file before displaying it. I'm using a unicode version of wxPython. I don't think my problem are wxPython-specific, but...
12
by: =?ISO-8859-1?Q?Thomas_B=F8rlum?= | last post by:
Hey all, I'm writing a c++ program that needs to read a file. I'm trying to read a file that is in the same directory as the executable. Everything works fine if I execute the program while in...
4
by: Python | last post by:
Hi there, I moved a few modules into the modules folder (on OSX: /opt/local/lib/ python2.5/site-packages/). They don't show up though when I start IDLE... Is there a way to reload the modules...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.