C# Winform 注册程序开机启动

1 开机启动

public 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");

 

C# Winform 注册程序开机启动,布布扣,bubuko.com

C# Winform 注册程序开机启动

上一篇:C# WinForm开发系列 - ComboBox


下一篇:redis window 安装测试--记录