473,386 Members | 1,820 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,386 software developers and data experts.

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 1844
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.