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();