473,382 Members | 1,362 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,382 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 52722
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?.
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: 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
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...
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...

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.