【发布时间】:2016-03-28 08:47:59
【问题描述】:
我编写了一个程序,它在 windows 启动时启动。我的代码是这样的:
public partial class Form1 : Form
{
RegistryKey reg = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);//kanei autostart to programma sto anoigma tou upologisti
public Form1()
{
reg.SetValue("Computer Integrity", Application.ExecutablePath.ToString());//computer integrity is the reg key name
reg.Close();
InitializeComponent();
}
现在的问题是,为了启动程序,在 windows 启动时,需要先打开它,这样密钥才会在“注册表编辑器”中注册。有没有办法创建一个文件(例如.bat)以便将此密钥注册到“注册表编辑器”,而无需打开程序??
【问题讨论】:
标签: registrykey