How to get installation path of an application?

后端 未结 6 1503
轻奢々
轻奢々 2020-12-06 05:54

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

6条回答
  •  自闭症患者
    2020-12-06 06:39

    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 cant do the same.

    May be you are using Windows Vista, which can search in Program Files, but won't look in other folders.

    In windows using C#, how to get the installation path of a software(for example consider nunit).?

    It depends, how you are installing the application. The installer knows the path, you may program the installer to write that path to somewhere, say registry.

    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.

    How do I get and set Environment variables in C#?

提交回复
热议问题