日期:2014-05-18 浏览次数:20929 次
//设置要开机启动的文件路径
string startup = Application.ExecutablePath;
//建立注册表的键值
RegistryKey rKey = Registry.LocalMachine;
//创建注册表的键
RegistryKey autoRun = rKey.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
//设置键值,第一个参数是名称,第二个参数是路径
autoRun.SetValue("BookServer", startup);
rKey.Close();