C#访问注册表

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Win32;
using System.Security.Permissions;

namespace RemoveTransReg
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] strArrRemovedCLSID = new string[15];
            strArrRemovedCLSID[0] = "bbb";

            string strCLSID = "CLSID";
            RegistryKey regKeyCLSID = Registry.ClassesRoot.OpenSubKey(strCLSID,  RegistryKeyPermissionCheck.ReadWriteSubTree);

            foreach(string strSubKey in strArrRemovedCLSID)
            {           
                regKeyCLSID.DeleteSubKeyTree(strSubKey);
            }            

            regKeyCLSID.Close();        
        }
    }
}
posted @ 2009-09-23 22:24  能巴  阅读(523)  评论(0)    收藏  举报