C# 设置开机自启
有两个方案
1.将快捷方式 拷贝到开机自启目录
string StartupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
if (string.IsNullOrEmpty(StartupPath))
{
string usrPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile);
StartupPath = usrPath + @"\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup";
if (!Directory.Exists(StartupPath))
Directory.CreateDirectory(StartupPath);
}
2.将开机自启写入注册表