473,386 Members | 1,748 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.

retrieve the application's path

Hi,
Is there any function to retrieve the application's path, path of the exe
file (as the property app.path of VB6).

thanks
Nhan
Jul 31 '07 #1
4 3281
On Tue, 31 Jul 2007 18:35:44 +0200, Thanh-Nhan Le <tn*******@yahoo.dewrote:
Hi,
Is there any function to retrieve the application's path, path of the exe
file (as the property app.path of VB6).

thanks
Nhan
Hi Nhan,

Try Environment.CurrentDirectory

--
Happy coding!
Morten Wennevik [C# MVP]
Jul 31 '07 #2
That's not guaranteed to give you the directory where the application
is, as the current directory can be changed through SetCurrentDirectory API.

A better solution would be to call the static GetEntryAssembly method on
the Assembly class, and then on that use the Location property or CodeBase
property (if shadow copying is a concern).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Morten Wennevik [C# MVP]" <Mo************@hotmail.comwrote in message
news:op.twb8uuh3dj93y5@stone...
On Tue, 31 Jul 2007 18:35:44 +0200, Thanh-Nhan Le <tn*******@yahoo.de>
wrote:
>Hi,
Is there any function to retrieve the application's path, path of the exe
file (as the property app.path of VB6).

thanks
Nhan

Hi Nhan,

Try Environment.CurrentDirectory

--
Happy coding!
Morten Wennevik [C# MVP]

Jul 31 '07 #3
I use this "System.AppDomain.CurrentDomain.BaseDirectory. " Other
application path methods give me the GAC path :)

--
cheers,
RL
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:uS****************@TK2MSFTNGP06.phx.gbl...
That's not guaranteed to give you the directory where the application
is, as the current directory can be changed through SetCurrentDirectory
API.

A better solution would be to call the static GetEntryAssembly method
on the Assembly class, and then on that use the Location property or
CodeBase property (if shadow copying is a concern).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Morten Wennevik [C# MVP]" <Mo************@hotmail.comwrote in message
news:op.twb8uuh3dj93y5@stone...
>On Tue, 31 Jul 2007 18:35:44 +0200, Thanh-Nhan Le <tn*******@yahoo.de>
wrote:
>>Hi,
Is there any function to retrieve the application's path, path of the
exe
file (as the property app.path of VB6).

thanks
Nhan

Hi Nhan,

Try Environment.CurrentDirectory

--
Happy coding!
Morten Wennevik [C# MVP]


Jul 31 '07 #4
"Thanh-Nhan Le" <tn*******@yahoo.dewrote on 7/31/2007 8:48:19 PM
>Hi,
Is there any function to retrieve the application's path, path of the exe
file (as the property app.path of VB6).

thanks
Nhan
Application.ExecutablePath()
or
Application.StartupPath()

gr.Leon
Aug 1 '07 #5

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

Similar topics

8
by: Dutchy | last post by:
Dear reader, In an attempt to obtain the path to the quick-launch-folder in order to create a shortcut to my application-updates during installation , I thought to: 1- check if quick launch...
1
by: Jan | last post by:
Hi, What is the easiest way to retrieve the path from a console application? Right now I am using: - System.Reflection.Assembly.GetEntryAssembly().Location to extract the path and filename -...
6
by: David Bowey | last post by:
Hi There! I'm writing a custom HttpHandler to create watermarks on my PNG images of my website. So typically, a PNG image is linked in an ASPX page as follows... <img src="images/test.png"...
6
by: Allen | last post by:
Hi, I want to retrieve the selected folder and entered file name from the SaveFilsDialog. The user is able to create or selected a different folder during the dialog displayed. If user enters...
2
by: * Tong * | last post by:
Hi, I'm wondering if you can show me an example php page that allows me to retrieve and display 3rd party pages. I.e., when my php script is called as http://site/path/getit.php?file_key it...
13
by: kev | last post by:
Hi all, I have created a database for equipments. I have a form to register the equipment meaning filling in all the particulars (ID, serial, type, location etc). I have two buttons at the end...
0
by: Ambed | last post by:
Hi, I have created a C# application in .Net and then created the setup using .Net and using installer class. Now whenever i am installing that application on a system with Visual Studio...
0
by: NETCODE | last post by:
I am developing an add-in. I need to retrieve the path of .msi file, located in under project properties, from the deployment project (setup). I was able retieve all project properties of all...
3
by: =?Utf-8?B?RGV2b24=?= | last post by:
Is it possible to retrieve a proper/invariant file or directory name using a lowercase full path string without having to resort to a call to GetDirectories()/GetFiles() using the...
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:
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
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
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.