C# Winform 注册程序开机启动
2020-12-13 04:14
标签:winform style blog color os art 1 开机启动 C# Winform 注册程序开机启动,搜素材,soscw.com C# Winform 注册程序开机启动 标签:winform style blog color os art 原文地址:http://www.cnblogs.com/gordensong/p/3837390.htmlpublic static bool SetAutoRun(string keyName, string filePath)
{
try
{
RegistryKey Local= Registry.LocalMachine;
RegistryKey runKey =Local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\");
runKey.SetValue(keyName, filePath);
Local.Close();
}
catch
{
return false;
}
return true;
}
SetAutoRun("exeName", Application.StartupPath + "\\step.exe");