读书人

怎么用C#语言通过修改注册表把一个程序

发布时间: 2012-05-27 05:42:30 作者: rapoo

如何用C#语言通过修改注册表把一个程序添加到开机启动项
如何用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;        } 

读书人网 >C#

热点推荐