c#怎么循環(huán)讀取注冊表某目錄下所有的子鍵/字符串值名稱
當前位置:點晴教程→知識管理交流
→『 技術(shù)文檔交流 』
獲取下面所有字符串值: 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; //獲取驅(qū)動路徑 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 編輯過
|
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |