天天看点

注册软件开机自启动

c# 实现代码如下

private void AutoStartEXE() 
        {
            Microsoft.Win32.RegistryKey registryKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey
                ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
            registryKey.SetValue("AnlogAutoStart", Application.ExecutablePath);//"AnlogAutoStart"自定义名称
        }
           

只需要调用此函数即可完成程序开机启动注册

测试环境win10

特此记录

anlog

2023年2月24日