如何在注册表项中搜索特定值 [英] How to search for specific value in Registry keys
问题描述
如何在注册表项中搜索特定值?
How can I search for specific value in the registry keys?
例如,我想在
HKEY_CLASSES_ROOT\Installer\Products
任何感谢C#中的代码示例,
any code sample in C# will be appreciated,
谢谢
推荐答案
在如果您不想依赖LogParser(功能如此强大):我来看看 Microsoft.Win32.RegistryKey
类( MSDN )。使用 OpenSubKey
打开HKEY_CLASSES_ROOT\Installer\Products,然后调用 GetSubKeyNames
来获取名称
In case you don't want to take a dependency on LogParser (as powerful as it is): I would take a look at the Microsoft.Win32.RegistryKey
class (MSDN). Use OpenSubKey
to open up HKEY_CLASSES_ROOT\Installer\Products, and then call GetSubKeyNames
to, well, get the names of the subkeys.
依次打开每个子键,调用 GetValue
来获取您感兴趣的值(我想是ProductName),然后将结果与所需内容进行比较。
Open up each of those in turn, call GetValue
for the value you're interested in (ProductName, I guess) and compare the result to what you're looking for.
这篇关于如何在注册表项中搜索特定值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!