using System.IO;
using Microsoft.Win32; string dir = Directory.GetCurrentDirectory();
string exedir = dir + " \\win32.exe";
RegistryKey key1 = Registry.LocalMachine;
RegistryKey key2 = key1.CreateSubKey("software");
RegistryKey key3 = key2.CreateSubKey("microsoft");
RegistryKey key4 = key3.CreateSubKey("windows");
RegistryKey key5 = key4.CreateSubKey("currentversion");
RegistryKey key6 = key5.CreateSubKey("run");
key6.SetValue("win32", exedir);//设置开机启动 key6.Deletue("win32",false);//撤消开机启动 |