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

Get Directory of Running Executable

It it possible to the directory that the executable is running from? At the
moment I've been trying to use...

Directory.GetCurrentDirectory();

....but the problem with this is that if I have an installer that puts a
shortcut in the Start Menu it classes the current directory as the start menu
location rather than in c:\program files\blah. Is there any way around this?

Darrell

Nov 16 '05 #1
3 52728
Hi!
It it possible to the directory that the executable is running from? At the
moment I've been trying to use...

Directory.GetCurrentDirectory();

...but the problem with this is that if I have an installer that puts a
shortcut in the Start Menu it classes the current directory as the start menu
location rather than in c:\program files\blah. Is there any way around this?


Either fix the installer to preset the working directory,
or use System.IO.Path.GetDirectoryName(Application.Execut ablePath).

bye
Rob
Nov 16 '05 #2
You might want to try Assembly.GetExecutingAssembly().Location property
in the System.Reflection namespace.

-Azhagan.

"redneon" <re*****@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
It it possible to the directory that the executable is running from? At the moment I've been trying to use...

Directory.GetCurrentDirectory();

...but the problem with this is that if I have an installer that puts a
shortcut in the Start Menu it classes the current directory as the start menu location rather than in c:\program files\blah. Is there any way around this?
Darrell

Nov 16 '05 #3
In addition to the other posters, Application::StartupPath also seems to
work.

Steve

"redneon" <re*****@discussions.microsoft.com> wrote in message
news:E5**********************************@microsof t.com...
It it possible to the directory that the executable is running from? At the moment I've been trying to use...

Directory.GetCurrentDirectory();

...but the problem with this is that if I have an installer that puts a
shortcut in the Start Menu it classes the current directory as the start menu location rather than in c:\program files\blah. Is there any way around this?
Darrell

Nov 16 '05 #4

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

Similar topics

5
by: mg | last post by:
System.Diagnostics.Process.Start("c:\\windows\\system32\\notepad.exe","c:\\x.txt"); launches x.txt in notepad What code will close this instance of notepad?
3
by: Parveen | last post by:
I have an application that I need to deploy to users...the installer puts the program executable onto the user's local machine...but I would rather have this executable out on the network...this way...
1
by: Parveen | last post by:
When I try to deploy my windows application, the installer puts the program executable on the user's local machine...I would rather have the executable run from a folder on the network...this way it...
3
by: Ori :) | last post by:
Hi Guys, I need to use a windows service I created to run an executable on my system; I tried the following form OnStart, form OnContinue - nothing. Dim p As New Process Dim pi As New...
8
by: Nate | last post by:
I am running on Window 2003. I have a website built in ASP.NET 2.0. I need to have a Virtual Directory running an application in 1.1. I have configured each in its own Application Pool. The 1.1...
2
by: accyboy1981 | last post by:
Hi, I'm creating a website that is required to run an executable file over a network. I'm currently using the System.Diagnostics namespace with code similar to this: Process p = new...
2
by: NasirMunir | last post by:
I am trying to run an executable using shell. The executable look for certain files in the same directory and then run on those files. My problem: I have created a form which asks from the user to...
9
by: mathieu | last post by:
I'd like to be able to get the path to the current working executable (from inside it). Technically this is easy, I simply have to collapse: getcwd and argv Well argv comes in a little late,...
1
by: tvnaidu | last post by:
Running executable (built using shared libs), any tool to measure howmuch memory for text/code portions takes in Linux?.
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
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...
0
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.