Q: Getting a directory

  • Thread starter Thread starter Geoff Jones
  • Start date Start date
G

Geoff Jones

Hiya

I have written a small application which I've then generated a setup project
to install the application on other computers.

How can I determine, from the application, where the program has been
installed to?

Thanks in advance

Geoff
 
Application.StartupPath()

Chris
 
Hi Herfried

Thanks for the suggestion. It isn't exactly what I want; although I didn't
make myself very clear.

Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufacturer" producing the
software. What I'd like to do is to find, within the application, the path
to this folder.

I guess this is done using the registry etc. but I'm unsure how to proceed.

Can you be of any further help?

Geoff
 
Geoff,

Geoff Jones said:
Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufacturer" producing the
software. What I'd like to do is to find, within the application, the path
to this folder.

Typically, the executable is installed into this directory.

You can use a WMI query ('System.Management') with the 'Win32_Product' class
and check its 'InstallLocation' property:

Platform SDK: Windows Management Instrumentation -- 'Win32_Product'
<URL:http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_product.asp>
 
Geoff,
I would use 'Application.StartupPath' as that is the path where the
executable is, it normally will be the path where it is installed to, unless
the user manually copies or moves the exe.

I would use System.IO.Path to get the individual parts of the StartupPath...

In addition to a WMI query to find the folder where it was installed, you
could have the Setup Project create a registry key that contains the path
where the app was installed to.

Hope this helps
Jay


Geoff Jones said:
Hi Herfried

Thanks for the suggestion. It isn't exactly what I want; although I didn't
make myself very clear.

Using the Deployment project, the application is stored in a directory
called, for example, ABC Ltd, which is the "Manufacturer" producing the
software. What I'd like to do is to find, within the application, the path
to this folder.

I guess this is done using the registry etc. but I'm unsure how to
proceed.

Can you be of any further help?

Geoff
 
Hi Jay

I'm interested further in your last point. I had a look at the deployment
project and couldn't see any options to writing to the registry. Just to
clarify, I am using the inbuilt deployment project in Visual Studio.

Could you help further?

Geoff

Jay B. Harlow said:
Geoff,
I would use 'Application.StartupPath' as that is the path where the
executable is, it normally will be the path where it is installed to,
unless the user manually copies or moves the exe.

I would use System.IO.Path to get the individual parts of the
StartupPath...

In addition to a WMI query to find the folder where it was installed, you
could have the Setup Project create a registry key that contains the path
where the app was installed to.

Hope this helps
Jay
 
Geoff,

All about the stephchild Deployment and Setup project seems to be hidden you
would expect it under Edit however it is.

When you have opened a setup project

View -> Editor ->Registry

I hope this helps?

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Q: Taskbar 2
Q: Version number 3
Q: Regular Expressions 2
Q: Cursor 4
Q: Closing a form 2
Q: SQL 9
temp directory question 6
COM dll accessable from double-click, but not from Start > Run? 5

Back
Top