使用C#在REGEDIT中搜索值 [英] Search for values in REGEDIT using C#
本文介绍了使用C#在REGEDIT中搜索值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
要使用c#
推荐答案
在registery的所有键和子键中获取给定值的键名,这是一个非常好的方法:http://snipplr.com/view/10315/ [ ^ ]
但首先请阅读以下内容: http://www.csharphelp.com/2007/01/registry-ins-and-outs-using-c/ [
This is a really nice one: http://snipplr.com/view/10315/[^]
But first of all read this: http://www.csharphelp.com/2007/01/registry-ins-and-outs-using-c/[^]
You need recursivity and this code snippet found by google for you will help also:
private void GetSubKeys(RegistryKey SubKey)
{
/*
here you can iterate the values in current subkey, and find what you want.
*/
foreach(string sub in SubKey.GetSubKeyNames())
{
RegistryKey local = Registry.Users;
local = SubKey.OpenSubKey(sub,true);
GetSubKeys(local); // By recalling itselfit makes sure it get all the subkey names
}
}
//This is how we call the recursive function GetSubKeys
RegistryKey OurKey = Registry.Users;
OurKey = OurKey.OpenSubKey(@".DEFAULT\test",true);
GetSubKeys(OurKey);
这篇关于使用C#在REGEDIT中搜索值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文