c# 写注册表的神奇问题

ahking 2019-10-28 11:55:04

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;
}




执行该方法后,在Run项下面冒出个子项:新项 #1
不只是怎么回事
...全文
43 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
Ival 2019-10-29
  • 打赏
  • 举报
回复
const string strSubKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"; 改成 const string strSubKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Run";

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧