c#怎么循环读取注册表某目录下所有的子键/字符串值名称
当前位置:点晴教程→知识管理交流
→『 技术文档交流 』
获取下面所有字符串值: private void button1_Click(object sender, EventArgs e) { RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\MAIN"); if(rk != null) { foreach (string vname in rk.GetValueNames()) { if (rk.GetValueKind(vname) == RegistryValueKind.String) //这里判断类型RegistryValueKind.DWord { Text1.Text = Text1.Text + "\r\n" + vname + ":" + rk.GetValue(vname); } } rk.Close(); } } 获取下面所有子键值: public static bool IsAisino() { bool IsAisino = false; //获取注册表路径 RegeditKey regeditKey = TaxSoftwareBaseInfo.GetRealyTrueRegeditPath(WindowsInfo.GetWindowsVersion()); RegistryKey regSubKey = null; //获取驱动路径 regSubKey = regeditKey.Registry.OpenSubKey(@"System\CurrentControlSet\Control\Print\Printers\", false); string[] rk = regSubKey.GetSubKeyNames(); foreach (var item in rk) { //这里就是要判断读取注册表的值 } } 该文章在 2021/2/18 15:34:33 编辑过
|
关键字查询
相关文章
正在查询... |