I want my app to create a file in a convenient exisiting folder. The logical
place to craete it would be the application's installation folder. Is there
any way that an application can get the path of its own installation - or,
equivelantly, the path from which it was run. (I was going to use
Environment.CommandLine, which includes the program name, but the help states
"The program name can, but is not required to, include path information."
--
Dave 5 2723
Dave wrote: I want my app to create a file in a convenient exisiting folder. The logical place to craete it would be the application's installation folder. Is there any way that an application can get the path of its own installation - or, equivelantly, the path from which it was run. (I was going to use Environment.CommandLine, which includes the program name, but the help states "The program name can, but is not required to, include path information."
Application.StartupPath will do what you want.
Matt
How about Assembly.GetEntryAssembly().CodeBase or one of the other
properties.
"Dave" <Da**@discussions.microsoft.com> wrote in message
news:B6**********************************@microsof t.com... I want my app to create a file in a convenient exisiting folder. The logical place to craete it would be the application's installation folder. Is there any way that an application can get the path of its own installation - or, equivelantly, the path from which it was run. (I was going to use Environment.CommandLine, which includes the program name, but the help states "The program name can, but is not required to, include path information." -- Dave
Found it - Application.ExecutablePath.
Shouldn't be so eager to post
--
Dave
"Dave" wrote: I want my app to create a file in a convenient exisiting folder. The logical place to craete it would be the application's installation folder. Is there any way that an application can get the path of its own installation - or, equivelantly, the path from which it was run. (I was going to use Environment.CommandLine, which includes the program name, but the help states "The program name can, but is not required to, include path information." -- Dave
Dave wrote: Found it - Application.ExecutablePath. Shouldn't be so eager to post
StartupPath is easier, you don't have to remove the executable name
that way.
:)
Matt
Not to leave out System.Environment.CurrentDirectory. They all have slightly
different effects and applications.
Peter
--
Co-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
"Dave" wrote: I want my app to create a file in a convenient exisiting folder. The logical place to craete it would be the application's installation folder. Is there any way that an application can get the path of its own installation - or, equivelantly, the path from which it was run. (I was going to use Environment.CommandLine, which includes the program name, but the help states "The program name can, but is not required to, include path information." -- Dave This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Paul Rubin |
last post by:
I'm writing a Windows program that needs to store some user files.
The logical place to store them is in "Application Data", right?
Is there a good way to find the correct location of that...
|
by: Hai-Chu Hsu |
last post by:
Hi,
I want to restore my databases from the old SQL Server installation
into a new installation of SQL Server. My new installation of SQL
Server has different data path from the old...
|
by: Bill Murray |
last post by:
I am using VS.NET 2003 and trying to deploy a service program(c++) to a Windows 2000 Server system. I have also written a small DLL (USSsetup.dll) that is used to start/stop the service using a...
|
by: InstallAware |
last post by:
For Press Inquiries:
Sinan Karaca
InstallAware Software Corporation
336 Guerrero Street, San Francisco CA 94103
415 358 4094 (voice/fax)
sinank@installaware.com
http://www.installaware.com/
...
|
by: srihari |
last post by:
Hai,
I am trying to install IBM DB2 8.1 on Red Hat linux 8.0. My
machine is Intel XEON 64bit. The installation went well except for the
creation of tools catalog. When I tried to install the tools...
| |
by: coosa |
last post by:
Hi,
I was installing SQL Server on my machine and during installation my PC
freezed. It happens frequently on my machine. So i tried after
restarting to install it again and since then i always...
|
by: jobs |
last post by:
Seems like I followed all steps but I can't find my service in the
service manager??
f:\windowsservice\EmptyService\EmptyService\bin\Debug>InstallUtil
EmptyS
ervice.exe
Microsoft (R) .NET...
|
by: =?Utf-8?B?UHVjY2E=?= |
last post by:
Hi, I'm using vs2005, .net 2, C# for windows application. In my application,
I use a C coded file that I use VS to compile into a dll for some of it's
functions. It works on my devvelopment PC. ...
|
by: zaza24 |
last post by:
Hello there
I am loosing my time since a few days trying to install a CRM (ACT! 2008 version 10) software on a brand new HP notebook with Vista prof OS.
Ths installation do not show any...
|
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,...
|
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...
| |
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,...
|
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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |