473,498 Members | 2,026 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

retrieving directory path where project executable is

VM
How can I retrieve the whole directory where my exe is located?
I would've thought Directory.GetCurrentDirectory worked but any event that
may change the dir (eg. OpenFileDialog or SaveFileDialog) will change the
current directory.

Thanks.


Nov 15 '05 #1
2 1847
Hi,

If your app is a windows exe you can use

Application.StartupPath

or

Path.GetDirectoryName(Application.ExecutablePath)

For assemblies you can use Assembly.Location

--
Ross Donald
Rad Software
Free Regular Expression Designer @
http://www.radsoftware.com.au/web/Products/

"VM" <Vm> wrote in message news:O0**************@tk2msftngp13.phx.gbl...
| How can I retrieve the whole directory where my exe is located?
| I would've thought Directory.GetCurrentDirectory worked but any event that
| may change the dir (eg. OpenFileDialog or SaveFileDialog) will change the
| current directory.
|
| Thanks.
|
|
|
|
Nov 15 '05 #2
Hi,

If your app is a windows exe you can use

Application.StartupPath

or

Path.GetDirectoryName(Application.ExecutablePath)

For assemblies you can use Assembly.Location

--
Ross Donald
Rad Software
Free Regular Expression Designer @
http://www.radsoftware.com.au/web/Products/

"VM" <Vm> wrote in message news:O0**************@tk2msftngp13.phx.gbl...
| How can I retrieve the whole directory where my exe is located?
| I would've thought Directory.GetCurrentDirectory worked but any event that
| may change the dir (eg. OpenFileDialog or SaveFileDialog) will change the
| current directory.
|
| Thanks.
|
|
|
|
Nov 15 '05 #3

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

Similar topics

11
2358
by: Fuzzyman | last post by:
What's the best, cross platform, way of finding out the directory a script is run from ? I've googled a bit, but can't get a clear answer. On sys.argv the docs say : argv is the script name...
2
1382
by: Paul Bearden | last post by:
I built a web application in C#.Net. It compiles and runs fine however... I need to move some of the files to a directory (actually another web site on the same server) to use the SSL...
2
23359
by: Rob Cowie | last post by:
Hi, Given a string representing the path to a file, what is the best way to get at the filename? Does the OS module provide a function to parse the path? or is it acceptable to split the string...
0
307
by: VM | last post by:
How can I retrieve the whole directory where my exe is located? I would've thought Directory.GetCurrentDirectory worked but any event that may change the dir (eg. OpenFileDialog or SaveFileDialog)...
4
2132
by: John Blair | last post by:
Hi, Can anyone tell me how to make the Copy Project option work from within Vb.net - it fails on my PC with an error saying the new copy directory is marked as executable and i am not allowed to...
11
1126
by: Geoff Jones | last post by:
Hiya I have written a small application which I've then generated a setup project to install the application on other computers. How can I determine, from the application, where the program...
15
1505
by: vishsid3 | last post by:
Hi guys , I am new to this forum . can anybody plz tell me - "how can I run a c executable in some directory ,while the executable is in some other directory " I am new to unix and c ,so any...
14
13494
by: gio | last post by:
I have a problem and the solution should works under windows and unix OS. Suppose I have a program ex.c in the directory X (so the current working directory of ex.c is X). Also suppose I have...
28
2090
by: Peter Oliphant | last post by:
I have written a program using MS VS VC++ 2005 Express, /cli pure. Upon compiling it it works fine in the GUI development environment. It also works fine as a Debug stand-alone. ut I had an odd...
0
6993
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7197
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...
1
6881
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5456
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1411
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
650
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
287
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.