码迷,mamicode.com
首页 > 其他好文 > 详细

如何写入和读取注册表

时间:2014-06-21 12:16:04      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:style   class   blog   code   color   get   

参考下面代码,写入和读取注册表

 1             string registrySubKey = @"SOFTWARE\RegistryTest";
 2             RegistryKey registryKey = Registry.LocalMachine.OpenSubKey(registrySubKey, true);
 3             if (registryKey == null)//没有则创建路径
 4             {
 5                 Registry.LocalMachine.CreateSubKey(registrySubKey);
 6                 registryKey = Registry.LocalMachine.OpenSubKey(registrySubKey, true);
 7             }
 8             //写入注册表
 9             registryKey.SetValue("Name", "zhangsan");
10             //读出注册表
11             Console.WriteLine(registryKey.GetValue("Name"));
12 
13             Console.Read();

 

如何写入和读取注册表,布布扣,bubuko.com

如何写入和读取注册表

标签:style   class   blog   code   color   get   

原文地址:http://www.cnblogs.com/mybky/p/3794839.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!