Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get installation path of an application?

Tags:

c#

windows

In Windows using C#, how can I get the installation path of a software (for example consider NUnit or any other software like MS word, etc.) from my project? Also how to set the path variables that we set in Environment variables so that we can run the application just by giving in command prompt.

Like if I install NUnit in "C:\Program Files" I can run it by giving 'NUnit' in cmd prompt but if I install in a different location I can't do the same. I need to get the location or path of NUnit or any other software installed in my system (having Windows XP) from my project.

EDIT: Like I can get the path of installed program from registry. HKEY_CURRENT_USER->SOFTWARE

like image 567
SyncMaster Avatar asked May 26 '09 09:05

SyncMaster


People also ask

How do you find the install path of a program?

To find the installation folder of a program using a desktop shortcut: From your desktop, right-click on the program's shortcut. Click on the Properties, and the Properties window should now be displayed. Click on the Shortcut tab, and you will find the installation path in the Target field.

What is installation path?

The installation path is the folder, relative to your domain name's document root folder. For example, if the installation path is “/” this means that your website will appear when someone types in yourdomain.com in their browser.

What is application installation directory?

Installation directory. The installation directory contains files such as executable files and default files that do not change when the system is running. You can change the default installation directory, but for a multiple server installation, use the same installation directory path on all servers.

How do I find the path of a Windows app?

Viewing the location of programs and apps downloaded from the Microsoft Store. Programs and apps downloaded from the Microsoft Store are installed in the following path by default: C:/Program Files/WindowsApps (Hidden items). To check hidden items, open This PC, click View and select Hidden items.


1 Answers

Use the system and application classes. This will give you all sorts of information.

EG: Application.ExecutablePath

It also provides methods to do what you want to.

Edit: Also see registry read/write instructions here:

http://www.c-sharpcorner.com/UploadFile/sushmita_kumari/RegistryKeys102082006061720AM/RegistryKeys1.aspx?ArticleID=0ce07333-c9ab-4a6a-bc5d-44ea2523e232

like image 91
Johan Bresler Avatar answered Oct 28 '22 07:10

Johan Bresler