如何获取应用程序的安装路径? [英] How to get installation path of an application?

查看:814
本文介绍了如何获取应用程序的安装路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Windows C#中,我怎样才能得到一个软件的安装路径(例如考虑NUnit的或任何其他软件,如MS Word等),从我的项目的 ?还怎么设置,我们在环境变量设置,这样我们就可以通过在命令提示符下给运行应用程序的路径变量。

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.

一样,如果我在安装NUnit的C:\Program文件我可以通过在CMD提示,但如果给'NUnit的运行它,我安装在不同的位置我不能这样做。
我需要得到的NUnit的位置或路径或安装在我的系统从我的项目(​​有Windows XP)中的任何其他软件。

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.

编辑:
就像我可以得到安装的程序从注册表路径。
HKEY_CURRENT_USER->软件

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

推荐答案

使用的系统和应用程序类。这会给你的各种信息

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

EG:Application.ExecutablePath

EG: Application.ExecutablePath

它还提供了一些方法做你想什么

It also provides methods to do what you want to.

编辑:又见注册表读/写指令的位置:

Also see registry read/write instructions here:

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

这篇关于如何获取应用程序的安装路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆