473,657 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I find the installation dorectory from code

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.Com mandLine, which includes the program name, but the help states
"The program name can, but is not required to, include path information."
--
Dave
Jan 4 '06 #1
5 2729

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.Com mandLine, which includes the program name, but the help states
"The program name can, but is not required to, include path information."


Application.Sta rtupPath will do what you want.

Matt

Jan 4 '06 #2
How about Assembly.GetEnt ryAssembly().Co deBase or one of the other
properties.

"Dave" <Da**@discussio ns.microsoft.co m> wrote in message
news:B6******** *************** ***********@mic rosoft.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.Com mandLine, which includes the program name, but the help
states
"The program name can, but is not required to, include path information."
--
Dave

Jan 4 '06 #3
Found it - Application.Exe cutablePath.
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.Com mandLine, which includes the program name, but the help states
"The program name can, but is not required to, include path information."
--
Dave

Jan 4 '06 #4

Dave wrote:
Found it - Application.Exe cutablePath.
Shouldn't be so eager to post


StartupPath is easier, you don't have to remove the executable name
that way.

:)

Matt

Jan 4 '06 #5
Not to leave out System.Environm ent.CurrentDire ctory. 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.Com mandLine, which includes the program name, but the help states
"The program name can, but is not required to, include path information."
--
Dave

Jan 5 '06 #6

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

Similar topics

7
11812
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 directory, preferably without any C extensions? It's ok if the directory is found at installation time rather than runtime, and bdist_wininst does have a way to find it from a post-installation script. The trouble is that the post-installation...
1
3186
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 installation. In addition, the data owners of some databases in the old SQL Server installation are not dbo. I have backups for all the databases in the old installation SQL Server. Can anyone tell me how to restore my databases from the old SQL Server
4
7405
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 custom action. This dll is apparently dependent on the MSVCP71.DLL and MSVCR71.DLL's as per the Detected Dependencies folder visible in the deployment project All this good except I am UNABLE to Retarget the output of the msm merge...
0
1843
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/ InstallAware First (and Only) Installation Toolkit to Support .NET 2.0
1
8091
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 catalog as a post installation task I get some java error. $ db2 CREATE TOOLS CATALOG SYSTOOLS USE EXISTING DATABASE TOOLSDB FORCE SQL22209N The DB2 Administration Server encountered an unexpected Java error on host "". I have jdk1.3 already...
4
7296
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 get the same error message: "An error occurred while creating one or more registry entries. Please see C:\WINDOWS\sqlstp.log for details. The problem could be caused by a low registry quota condition" I have tried to clean the registry and i...
1
9956
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 Framework Installation utility Version 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.
6
1274
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. I created a Setup project for the application. In the file syste, I added the dll. After successful installation on a target machine, I get error of not able to find the dll when I run the applicaiton. I checked the program files directory and...
0
2748
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 troubles and works fine; the software installs also Microsoft SQL Server Express 2005 (the different services installed are SQL Server for ACT7, SQL server Active Directory Helper, SQL Server Browser and SQL Server VSS Writer). SQL Service for ACT7 is in...
0
8306
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.