Way to write on registry location

后端 未结 3 911
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-10 09:21

work on C# window application.I want to write on registry.i know how to write on registry.I use bellow syntax to write on registry.

        Microsoft.Win32.R         


        
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-10 09:38

    RegistryKey reg = Registry.LocalMachine.
                      OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", true);
    
    // set value of "abc" to "efd" 
    reg.SetValue("abc", "efd", RegistryValueKind.DWord);
    
    // get value of "abc"; return 0 if value not found 
    string value = (string)reg.GetValue("abc", "0");
    

提交回复
热议问题