C#注册表编程

来源:互联网 发布:台湾生活 知乎 编辑:程序博客网 时间:2024/06/16 00:01

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Win32;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           RegistryKey rkey = Registry.CurrentUser;
           RegistryKey rkey1 = rkey.OpenSubKey("aa\\baoTest", true);//打开aa\\baoText路径
            RegistryKey rkey2 = rkey1.CreateSubKey("bao");//创建子项"bao"
            rkey2.SetValue("Name","dd");//为bao建子键name 赋值dd
            rkey2.Close();
            rkey1.Close();
                 }
    }
}


原创粉丝点击