安装后如何获取程序的根文件夹 [英] how can i get the root folder for my program after setup

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

问题描述

大家好,我想知道我如何获取安装后程序从其开始的文件夹的路径
示例
任何程序的默认目录为:
c:\ program files \ ***** \ ****
但是用户可以将此路径更改为任何其他路径

我的问题是我如何获取此路径

我已经尝试过(Environment.CurrentDirectory);但是它没有用
它返回了(我的文档路径)
任何机构都可以帮助我??

hi every body

i want know how can i get the path of the folder which the program start from it after install

example
the default directory for any program is :
c:\program files\*****\****

but user may change this path to any another path

my question is how can i get this path

i have tried (Environment.CurrentDirectory);
but it didn`t work
it returned by (My documents path)
any body can help me ??

推荐答案

Application.StartupPath在大多数情况下都可以运行.

Environment.CurrentDirectory仅获取当前的工作目录-与应用程序本身无关.

Application.StartupPath works under most situations.

Environment.CurrentDirectory only gets the current working directory - nothing to do with the application itself.


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

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