1. 程式人生 > >「C#」刪除登錄檔中的值

「C#」刪除登錄檔中的值

using Microsoft.Win32;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace reg_AutoStart
{
    static class Program
    {
        /// <summary>
        /// 應用程式的主入口點。
        /// </summary>
        [STAThread]
        static void Main()
        {
            try
            {       RegistryKey R_local = Registry.CurrentUser;
                    //RegistryKey R_local = Registry.LocalMachine;
                    RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
                    R_run.DeleteValue("adobe", false); //adobe是值得名稱
                    R_run.Close();
                    R_local.Close();

            }
            catch
            {
               
            }
        }
    }
}