在C#程序中检索安装目录的路径 [英] Retrieving the path of the installation directory in a C# program

查看:52
本文介绍了在C#程序中检索安装目录的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

有没有一种方法可以在C#程序中查找从哪个安装目录加载了它.环境仅提供当前目录,而不提供安装目录.

非常感谢任何提示.

Wolfgang

Hello,

is there a way to find out within a C# program, from which installation directory it was loaded. The Environment just gives the current directory but not the installation directory.

Any hint is very much appreciated.

Wolfgang

推荐答案

尝试一下:
Try this:
string path = System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName);


希望对您有所帮助.


Hope this helps.


您好

很棒,效果很好.

沃尔夫冈
Hello

great, it works perfect.

Wolfgang


这篇关于在C#程序中检索安装目录的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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