直接给源码:
读取注册表内容:
1 RegistryKey regkey=Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); 2 string[] n=regkey.GetValueNames(); 3 for(int i=0;i<n.Length;i++) 4 { 5 Response.Write(n[i]+": "+regkey.GetValue(n[i])+"<br >"); 6 }
写入注册表:
1 RegistryKey regkeySetKey = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run",true).CreateSubKey("test_test"); 2 regkeySetKey.SetValue("Key1","Value1"); 3 regkeySetKey.SetValue("Key2","Value2"); 4 regkeySetKey.SetValue("Key3",3);
时间: 2024-10-09 09:23:46