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

how to determine the directory from where app is loaded

Hi,

How can I determine the directory from which my app is started. Since upon
installation the user can decide in which directory to install the file...I
want to be able to load a file from a directory within that install
directory no matter what it is.
How best to deal with this?

Tx.
Nov 15 '05 #1
6 1341
dawn wrote:
How best to deal with this?


string path =
System.Reflection.Assembly.GetExecutingAssembly(). Location;
System.IO.FileInfo info = new System.IO.FileInfo(path);
Console.WriteLine(info.DirectoryName);

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)
Nov 15 '05 #2
another method

System.Diagnostics.Process.GetCurrentProcess().Mai nModule.FileName;
--
Michael Culley
"Frank Oquendo" <fr*******@acadx.com> wrote in message news:eg**************@TK2MSFTNGP12.phx.gbl...
dawn wrote:
How best to deal with this?


string path =
System.Reflection.Assembly.GetExecutingAssembly(). Location;
System.IO.FileInfo info = new System.IO.FileInfo(path);
Console.WriteLine(info.DirectoryName);

--
There are 10 kinds of people. Those who understand binary and those who
don't.

http://code.acadx.com
(Pull the pin to reply)

Nov 15 '05 #3
Jon
What about this:
Environment.CommandLine[0];

http://www.naptaxes.com/AAJ/
[AllAmericanJobs - Searching jobs from your desktop and automatically
sends resume.]
---------------------------------------------------------


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 15 '05 #4
Environment.CurrentDirectory

Gets and sets the fully qualified path of the current directory; that is,
the directory from which this process starts.

HTH

Glenn

This will return the directory

"dawn" <da******@hotmail.com> wrote in message
news:_C********************@phobos.telenet-ops.be...
Hi,

How can I determine the directory from which my app is started. Since upon
installation the user can decide in which directory to install the file...I want to be able to load a file from a directory within that install
directory no matter what it is.
How best to deal with this?

Tx.

Nov 15 '05 #5
"Jon" <an*******@devdex.com> wrote in message news:Ot**************@TK2MSFTNGP09.phx.gbl...
What about this:
Environment.CommandLine[0];


I guess it's great if you want a single " :-)

--
Michael Culley
Nov 15 '05 #6
I thought that Application.StartupPath gave us this information... Am I
missing something?
"Jon" <an*******@devdex.com> wrote in message
news:Ot**************@TK2MSFTNGP09.phx.gbl...
What about this:
Environment.CommandLine[0];

http://www.naptaxes.com/AAJ/
[AllAmericanJobs - Searching jobs from your desktop and automatically
sends resume.]
---------------------------------------------------------


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 15 '05 #7

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

Similar topics

5
by: bart plessers | last post by:
Hello, Currently I am developping a internet "directory browser" My page 'default.asp' has following entries: CurrentPATH = Request("MyLink") Set oFSO =...
4
by: Bart Plessers \(artabel\) | last post by:
Hello, I have an asp script that lists the files in a directory: CurrentPATH = "c:\temp\" Set oFSO = CreateObject("Scripting.FileSystemObject") Set oFolder = oFSO.GetFolder(CurrentPATH) Set...
3
by: lucpustjens | last post by:
Hello, I want te determine the client operating system, because I need to kno the default cookie directory. If there is a way to determine the cooki directory directly, than it is also good. ...
2
by: Edward | last post by:
I have the following function to determine if a form is loaded: Public Function modIsloaded(ByVal vstrFormName As String) As Boolean ' Error handling removed for concision ' Determine if...
6
by: TTD | last post by:
Hello, I need to create a directory in code, but when de directory already exists, I get err.number 75. Since the creation already is in the part where a former error is sent, I can't catch...
4
by: Michael Malinowski | last post by:
Is there a way to read the directory that the currently running python file is located in? Cheers Mike.
2
by: Markus | last post by:
Hello Is it possible to determine the PHP path to the FTP base directory? ftp_pwd($conn_id) returns '/', while I need something like '/data/users/domain.com/'. I used a construct such as: ...
6
by: titan.nyquist | last post by:
The WebBrowser control won't load a css file written in the same directory as the program. If I put an absolute path to it, it will load it. Thus, the current directory of the WebBrowser control...
6
by: falconsx23 | last post by:
I am trying to write a code for a Phone Directory program. This program is suppose to allow the user to enter a name or directory and then program can either add, save or even delete an entry. Also...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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.