.net 修改程序在注册表中的键值

开机自启动

RegistryKey R_local = Registry.LocalMachine;//RegistryKey R_local = Registry.CurrentUser;
                    RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
                    R_run.SetValue("清大东方定时扫描任务", Application.ExecutablePath);
                    R_run.Close();
                    R_local.Close();

 

关闭自启动

RegistryKey R_local = Registry.LocalMachine;//RegistryKey R_local = Registry.CurrentUser;
                    RegistryKey R_run = R_local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
                    R_run.DeleteValue("清大东方定时扫描任务", false);
                    R_run.Close();
                    R_local.Close();

 

posted @ 2020-07-17 09:15  zeroooooo~  阅读(140)  评论(0)    收藏  举报