如何使用C#在Windows应用程序中查找已安装的可执行文件的完整目录路径

如何使用C#在Windows应用程序中查找已安装的可执行文件的完整目录路径

问题描述:

亲爱的朋友

我有一个与主题相关的查询.实际上,我的查询是我开发了Windows应用程序并安装在系统上.

现在,我创建了一个新的Windows应用程序,其中必须获取已安装应用程序的完整路径,即我的应用程序的安装位置.

因此,请尽快帮助我.我正在等待回复.

Dear Friends

I have a query related to my subject.Actually my query is this that i have developed a Windows application and installed on my system.

Now I have create a new windows application in which i have to get the complete path of installed application i.e where my application is installed.

So Please help me out as soon as possible. I m waiting for reply''s.

Thanks lot in advance.

没有函数可以从另一个Windows应用程序获取一个exe的路径.
您可以做的是,可以遍历程序文件目录以从第二个应用程序中找到第一个应用程序目录.
第二种选择是您可以创建第一个应用程序的注册表项,然后从第二个应用程序中找到注册表项.这将是更好的方法.
There is no function to get path of one exe from another windows application.
What you can do is you can iterate program files directory to find your first application directory from second application.
Second option is you can make a registry entry of first application and find entry in registry from second application.This will be better approach.


使用此属性

use this property

string path = Application.StartupPath ;