110,536
社区成员
发帖
与我相关
我的任务
分享
string fileFullName = @System.Windows.Forms.Application.ExecutablePath;
string fileName = fileFullName.Substring(fileFullName.LastIndexOf("\\") + 1);
const string strSubKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\";
RegistryKey rKey = Registry.LocalMachine.OpenSubKey(strSubKey,true);
if (rKey != null)
{
//MessageBox.Show(rKey.Name);
rKey.SetValue(fileName, fileFullName);//Run下面冒出一个新项 #1
rKey.Close();
this.Menu_config_autoRun.Checked = true;
}