using Microsoft.Win32;
这下面是个带参的开机启动函数
/// <summary>
/// 开机启动
/// </summary>
/// <param name="Name">在注册表中的名称</param>
public void StartRun(string Name)
{
try
{
string FilePath =Application.ExecutablePath;
Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true).SetValue(Name, FilePath);
}
catch
{ }
}