简体   繁体   English

在VB.net中获取其他应用程序路径

[英]Get other application path in VB.net

I have two application which is will installed on same PC. 我有两个将安装在同一台PC上的应用程序。 Usually client will install it on C:\\Program Files , but sometime there are some user install it on D:\\ F:\\ or somewhere they like. 通常,客户端会将其安装在C:\\ Program Files上,但有时会有一些用户将其安装在D:\\ F:\\或他们喜欢的某个位置。 So i'm struggling to get other app executable path. 所以我正在努力获取其他应用程序的可执行路径。

For illustration : 例如:

  • App 1 location : G:\\App1 Folder\\App1.exe 应用1的位置:G:\\ App1文件夹\\ App1.exe
  • App 2 location : C:\\Program Files\\App2 Folder\\App2.exe App 2的位置:C:\\ Program Files \\ App2 Folder \\ App2.exe

How i can get other App2 executable path on App 1 ("G:\\App1 Folder\\App1.exe") ? 我如何在App 1上获取其他App2可执行路径(“ G:\\ App1 Folder \\ App1.exe”)?

You can use 您可以使用

Dim strPath As String = System.IO.Path.GetDirectoryName( _ System.Reflection.Assembly.GetExecutingAssembly().CodeBase) to get Executable directory when app runs and store into registery or some where else. Dim strPath As String = System.IO.Path.GetDirectoryName( _ System.Reflection.Assembly.GetExecutingAssembly().CodeBase)以在应用程序运行时获取可执行目录,并将其存储在寄存器中或其他地方。 Ref. 参考。

or 要么

Ask user to locate executable during 1st run and save location to some place 要求用户在第一次运行期间找到可执行文件,并将位置保存到某个位置

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM