从检索注册表文件的安装路径 [英] Retrieving file installation path from registry

查看:375
本文介绍了从检索注册表文件的安装路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个WPF工具,它需要访问本地计算机的注册表,以再找出程序的安装路径。

I am creating a WPF utility which needs to access the registry of the local machine, to then find out the installation path of the program.

我导航通过注册表编辑器钥匙,它给出了一个名称,类型和数据时,数据在它显示了安装路径,我想解压安装路径。

I've navigated to the key via Regedit and it gives a Name, Type and Data, within the Data it shows the installation path, I would like to extract the installation path.

我知道我需要导航到注册表中此项:

I know I need to navigate to this key within the registry:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\

那么我就需要这个键与有关安装路径的信息中访问文件夹

then I need to access a folder within this key with the information regarding the installation path.

-

推荐答案

我解决我的问题,任何人谁想要在未来的解决方案,如果您对本请留言后仍然停留我,我会帮我:)发现这是很难找到的资源。

I solved my problem, to anyone who wants a solution in the future if your still stuck after this please message me and I'll help :) I found it was hard to find the resources.

RegistryKey key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\App Paths\myexe.exe");
                string regFilePath = null;

                object objRegisteredValue = key.GetValue("");

                registeredFilePath = value.ToString();

这篇关于从检索注册表文件的安装路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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