我想把我写的c#程序随windows启动(开机启动), 我该怎么写呢
2011-03-08 10:56
555 查看
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");
{
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");
相关文章推荐
- 我想把我写的c#程序随windows启动(开机启动), 我该怎么写呢
- windows操作系统下怎么设置开机启动程序
- C# 编写Windows服务实现开机启动一个程序
- windows操作系统下怎么设置开机启动程序
- 让你写的c#程序一开机就自动运行 Windows服务实现开机启动
- C# WF程序 开机启动和托盘显示
- c#怎样打包 可以使另一个程序随开机自动启动
- C# winForm程序开机启动和托盘显示 (转http://blog.csdn.net/xinyue3054/article/details/6599508)
- 两个小知识:C#如何设置开机启动时自动执行程序|C# WinForm打开超链接
- c#实现程序的开机启动
- C# Windows服务启动错误1083配置成在该可执行程序中运行的这个服务不能执行该服务
- winform(c#) 开机自动启动程序
- 在MAC系统里添加开机启动任务(但是怎么才能知道自己程序的固定位置呢?)
- C# 程序开机启动
- C# 程序开机启动
- Windows开机自动启动程序在哪里?[转]
- C# 实现程序的开机启动
- c# 通过Windows服务启动外部程序
- C# 自己写了一个windows服务程序,运行时错误: 错误 1053: 服务没有及时响应启动或控制请求。(推荐)
- c#设置开机自动启动程序本篇文章来源于: