获取应用安装路径。 [英] Get application installation path.

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

问题描述

我需要在安装程序后获取程序的路径。在其他

字样中,我希望能够运行一个单独的应用程序来获取其他应用程序app.config文件的路径。这需要工作无论用户在哪里安装第一个应用程序,我宁愿避免查看

注册表。


谢谢,

Shawn

I need to get the path to my program after it has been installed. In other
words, I want to be able to run a separate application that gets the path to
the other apps app.config file. This needs to work no matter where the user
installed the first app to and I would prefer to avoid looking at the
registry.

Thanks,
Shawn

推荐答案

如果这是两个完全独立的装置,那么我认为最简单的/>
方式将是应用程序一,为它设置一个众所周知的注册表项

家庭位置。应用程序2将读取注册表项以查找

配置文件。


" Shawn"写道:
If these are two completely separate installations, then I think the easiest
way would be for application one to set up a well known registry key for it''s
home location. The registry key will be read by application two to find the
config file.

"Shawn" wrote:

我需要在安装程序后获取程序的路径。在其他

字样中,我希望能够运行一个单独的应用程序来获取其他应用程序app.config文件的路径。这需要工作无论用户在哪里安装第一个应用程序,我宁愿避免查看

注册表。


谢谢,

Shawn
I need to get the path to my program after it has been installed. In other
words, I want to be able to run a separate application that gets the path to
the other apps app.config file. This needs to work no matter where the user
installed the first app to and I would prefer to avoid looking at the
registry.

Thanks,
Shawn


5月24日下午3:39,Shawn < sscam ... @ bellsouth.netwrote:
On May 24, 3:39 pm, "Shawn" <sscam...@bellsouth.netwrote:

我需要在安装程序后获取程序的路径。在其他

字样中,我希望能够运行一个单独的应用程序来获取其他应用程序app.config文件的路径。这需要工作无论用户在哪里安装第一个应用程序,我宁愿避免查看

注册表。


谢谢,

Shawn
I need to get the path to my program after it has been installed. In other
words, I want to be able to run a separate application that gets the path to
the other apps app.config file. This needs to work no matter where the user
installed the first app to and I would prefer to avoid looking at the
registry.

Thanks,
Shawn



嗨Shawn,

如果你想得到当前的工作目录路径您的应用程序,

您可以使用:


My.Computer.Filesystem.CurrentDirectory


所以,到获取应用程序的确切当前路径,将应用程序的名称

与文件夹'结合使用:


Dim currentfolder As String

currentfolder = My.Computer.Filesystem.CurrentDirectory


''获取应用程序的完整当前路径

System.IO.Path.Combine(currentfolder, " appname.exe")

希望这会有所帮助,


OnurGüzel

Hi Shawn,
If you want to get current working directory path of your application,
you can use:

My.Computer.Filesystem.CurrentDirectory

So, to get exact current path of your application, combine app''s name
with folder''s :

Dim currentfolder As String
currentfolder = My.Computer.Filesystem.CurrentDirectory

'' Get full current path to your application
System.IO.Path.Combine(currentfolder,"appname.exe" )
Hope this helps,

Onur Güzel


谢谢你回复,但我试图避免注册表,因为我已阅读

微软将不支持在注册表中的注册表释放(至少肯定不是
)以及其他原因。有没有办法通过

WMI或其他东西来做到这一点?


Family Tree Mike < Fa ************ @ discussion.microsoft.com写在

消息新闻:88 **************** ****************** @ microsof t.com ...
Thanks for the reply, but I am trying to avoid the registry as I have read
that Microsoft will not support a registry in future releases (at least not
for sure) and for other reasons as well. Is there a way to do this through
WMI or something?

"Family Tree Mike" <Fa************@discussions.microsoft.comwrote in
message news:88**********************************@microsof t.com...

如果这是两个完全独立的安装,然后我认为

最简单的方式是b $ b的方式是为应用程序一设置一个众所周知的注册表项

它是什么? />
家庭位置。应用程序2将读取注册表项以查找

配置文件。


" Shawn"写道:
If these are two completely separate installations, then I think the
easiest
way would be for application one to set up a well known registry key for
it''s
home location. The registry key will be read by application two to find
the
config file.

"Shawn" wrote:

>我需要在安装程序后获取程序的路径。在
其他单词中,我希望能够运行一个单独的应用程序来获取其他应用程序app.config文件的路径。无论用户在哪里安装第一个应用程序,这都需要工作,我宁愿避免查看
注册表。

谢谢,肖恩



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

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