Enumerating Registry Keys : Registry « Windows « C# / C Sharp






Enumerating Registry Keys

using System;
using Microsoft.Win32;
   
  class Class1
  {
    static void Main(string[] args)
    {
      RegistryKey myRegKey=Registry.LocalMachine;
      myRegKey=myRegKey.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall");
      String [] subkeyNames = myRegKey.GetSubKeyNames();
      foreach (String s in subkeyNames) {
        RegistryKey UninstallKey=Registry.LocalMachine;
        UninstallKey=UninstallKey.OpenSubKey ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\" + s);
        Object oValue=UninstallKey.GetValue("DisplayName");
        Console.WriteLine(oValue.ToString());
      }
    }
  }

           
       








Related examples in the same category

1.Save value to registery
2.Read value from registry
3.Retrieve the CPU Type and Speed from the Registry
4.Write a Text and DWord Value to the Registry
5.Get registry value from LocalMachine key