怎么用C#语言通过修改注册表把一个程序添加到开机启动项
如何用C#语言通过修改注册表把一个程序添加到开机启动项
如何用C#语言通过修改注册表把一个程序添加到开机启动项
------解决方案--------------------
加上 using Microsoft.Win32;
如何用C#语言通过修改注册表把一个程序添加到开机启动项
------解决方案--------------------
加上 using Microsoft.Win32;
- C# code
public static bool SetAutoRun(string keyName,string filePath) { try { RegistryKey runKey=Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",true); runKey.SetValue(keyName,filePath); runKey.Close(); } catch { return false; } return true; }