简体   繁体   English

如何使用C#使用Registry查找软件的安装位置

[英]How to find the installed location of a software with Registry using C#

I'm a beginner to Registry keys, and 我是注册表项的初学者,并且
I want to find out the installed location of AutoCAD software which have the higher version of it using C#. 我想用C#找出具有更高版本的AutoCAD软件的安装位置。
More than one AutoCAD may get installed on a computer(AutoCAD 2012, AutoCAD 2014, etc), I want to get higher version alone., (result will be path of AutoCAD 2014(acad.exe)) 我可能想在计算机上安装多个AutoCAD(AutoCAD 2012,AutoCAD 2014等),我想单独获得更高版本。(结果将是AutoCAD 2014(acad.exe)的路径)

And also have to find out acCoreConsole.exe file isExist on the path found in previous result.. 并且还必须在先前结果中找到的路径上找到acCoreConsole.exe文件isExist。

I can't browse through the location of Registry., 我无法浏览注册表的位置。,

HKEY_LOCAL_MACHINE\Software\Autodesk\AutoCAD\R18.2\ACAD-D001:409\AcadLocation

I tried this code: 我尝试了这段代码:

Registry.LocalMachine.OpenSubKey("Software\\Autodesk\\AutoCAD", false).GetSubKeyNames();

But this leads to somewhere else: 但这导致了其他地方:

HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Autodesk\\ADSKAssetLibrary

I don't know how to get the location of acad.exe., I'm using 64 bit machine. 我不知道如何获取acad.exe的位置。我正在使用64位计算机。 Any help would be appreciateable., Please do the needful, Thanks, 任何帮助将不胜感激。,请做有需要的,谢谢,

Your application is most likely running 32 bit, because it seems like you get autoredirected to WoW6432Node which is the default directory for 32 bit applications. 您的应用程序很可能在运行32位,因为您似乎自动重定向到了WoW6432Node,它是32位应用程序的默认目录。

Try this code: 试试这个代码:

RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"your path here", false);

I'm pretty sure you run a 32 bit app on a 64 bit machine, I've had this problem before as well 我很确定您在64位计算机上运行了32位应用程序,之前我也遇到过此问题

EDIT: Forgot to append the last part of your command, but you can just append it I guess 编辑:忘记附加您的命令的最后一部分,但是您只能附加它

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

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