1 开机启动
public static bool SetAutoRun(string keyName, string filePath) { try { RegistryKey Local= Registry.LocalMachine; RegistryKey runKey =Local.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"); runKey.SetValue(keyName, filePath); Local.Close(); } catch { return false; } return true; }
SetAutoRun("exeName", Application.StartupPath + "\\step.exe");