如何写C#应用程序去遍历(查找)注册表中的某个键值?

时间:2022-09-05 08:26:49
我想查找某个键值,但是不知道它的具体位置,该怎么做?

6 个解决方案

#1


http://community.csdn.net/Expert/topic/3181/3181018.xml?temp=.3210718
http://community.csdn.net/Expert/topic/3605/3605260.xml?temp=.6409113

#2


http://www.cnblogs.com/lovecherry/archive/2005/06/21/178169.html

#3


我这篇文章里有关于读取注册表的操作,参考一下
http://www.cnblogs.com/hedonister/archive/2005/06/21/178125.html

关键代码:
string str; 
RegistryKey rootKey; 
RegistryKey subKey; 
string[] dsnList; 
rootKey = Registry.LocalMachine; 
str = "SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\ODBC Data Sources"; 
subKey = rootKey.OpenSubKey(str); 
dsnList = subKey.GetValueNames();

需要自己改

#4


楼上两位大哥: 你们的方法都是指定了“注册表中的项”! 而我要找的“键值”根本就不知道位于什么地方~

#5


自己顶一下!

#6


使用递规。。。和遍历文件夹树差不多。。。。。

#1


http://community.csdn.net/Expert/topic/3181/3181018.xml?temp=.3210718
http://community.csdn.net/Expert/topic/3605/3605260.xml?temp=.6409113

#2


http://www.cnblogs.com/lovecherry/archive/2005/06/21/178169.html

#3


我这篇文章里有关于读取注册表的操作,参考一下
http://www.cnblogs.com/hedonister/archive/2005/06/21/178125.html

关键代码:
string str; 
RegistryKey rootKey; 
RegistryKey subKey; 
string[] dsnList; 
rootKey = Registry.LocalMachine; 
str = "SOFTWARE\\\\ODBC\\\\ODBC.INI\\\\ODBC Data Sources"; 
subKey = rootKey.OpenSubKey(str); 
dsnList = subKey.GetValueNames();

需要自己改

#4


楼上两位大哥: 你们的方法都是指定了“注册表中的项”! 而我要找的“键值”根本就不知道位于什么地方~

#5


自己顶一下!

#6


使用递规。。。和遍历文件夹树差不多。。。。。