【C#】 开机启动/取消开机启动

来源:互联网 发布:源码分享吧 编辑:程序博客网 时间:2024/06/06 05:28
1、开机启动

using Microsoft.Win32;RegistryKey runKey = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");runKey.SetValue("Check", "\"" +Application.ExecutablePath + "\"");runKey.Close();

2、取消开机启动

RegistryKey runKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run",true);runKey.DeleteValue("Check");runKey.Close();

 

0 0
原创粉丝点击