C#设置程序开机自启动

//设置自启动    
    private void setStart_Click(object sender, EventArgs e)
        {
            RegistryKey R_local = Registry.LocalMachine; 
            RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
            R_run.SetValue("test", Application.ExecutablePath);
            R_run.Close();
            R_local.Close();
        }
//取消自启动
        private void button3_Click(object sender, EventArgs e)
        {
            RegistryKey R_local = Registry.LocalMachine; 
            RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
            R_run.DeleteValue("test", false);
            R_run.Close();
            R_local.Close();
        }

0 0 投票数
文章评分
订阅评论
提醒
guest
0 评论
最旧
最新 最多投票
内联反馈
查看所有评论
0
希望看到您的想法,请您发表评论x