yulei's blog

有梦想更有要有行动,每天前进一小步,那么每年可以迈出一大步 QQ:65072096 MSN:coolsoft2001@sina.com

导航

c#实现程序开机自动运行

代码如下: RegistryKey KeyCon=Registry.LocalMachine.OpenSubKey( "Software\\Microsoft\\Windows\\CurrentVersion\\Run",true); string MyKey= "Terminal"; if((string)KeyCon.GetValue(MyKey,"no") == "no")//指定的键不存在 { string Path = Application.StartupPath+@"\Terminal.exe"; KeyCon.SetValue(MyKey,Path); //设置注册表中的启动键 }

posted on 2007-06-13 14:55  yulei  阅读(1391)  评论(0编辑  收藏  举报