首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > windows >

小弟我想把小弟我写的c#程序随windows启动(开机启动), 小弟我该如何写呢

2012-10-08 
我想把我写的c#程序随windows启动(开机启动), 我该怎么写呢?public static bool SetAutoRun(string keyNam

我想把我写的c#程序随windows启动(开机启动), 我该怎么写呢
?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;
??????? }

test: SetAutoRun("myexe","c:\\text.exe");

热点排行