怎样用C#修改注册表 来启动某个服务

解决方案 »

  1.   

    using Microsoft.Win32 ;RegistryKey 
      

  2.   

    例如,CurrentUser->Software下的TEST键:
    using Microsoft.Win32;RegistryKey key = Registry.CurrentUser;
    RegistryKey Explorer = key.OpenSubKey("Software", true);
    RegistryKey key1 = Explorer.CreateSubKey("TEST");
    key1.SetValue("NoFind", 1);
    key1.Close();
      

  3.   

    上面在注册表中新建了一个测试项,要修改CurrentUser->Software->TEST中NoFind的值,则是:RegistryKey key = Registry.CurrentUser.OpenSubKey("Software", true);
    RegistryKey key1 = key.OpenSubKey("TEST", true);
    key1.SetValue("NoFind", 3);