- using (RegistryKey keyRun = Registry.LocalMachine.OpenSubKey(@”Software\Microsoft\Windows\CurrentVersion\Run”))
- {
- foreach (string valueName in keyRun.GetValueNames())
- {
- Console.WriteLine(“Name: {0}\tValue: {1}”, valueName, keyRun.GetValue(valueName));
- }
- }
请添加命名空间Microsoft.Win32,以确保上面的代码可以编译。
来源: http://www.phpxs.com/code/1004415/