【C#】通过Registry操作注册表

例如读取下面的注册表中的(git-bash.exe)的值

string REG_SUBKEY = @"Directory\Background\shell\git_shell\command";
using (RegistryKey gitBashReg = Registry.ClassesRoot.OpenSubKey(REG_SUBKEY))
{
      if (gitBashReg != null)
      {
             gitBashPath = (string)gitBashReg.GetValue(null);
       }
}

 

其他节点的方法参照:

posted @ 2021-03-02 11:52  Victor-ZhuFeng  阅读(499)  评论(0编辑  收藏  举报