如何让我的程序在电脑开机的时候自动运行

NextPage 2009-10-20 07:31:00
请教各位大侠啦,谢谢啦
...全文
228 19 打赏 收藏 转发到动态 举报
写回复
用AI写文章
19 条回复
切换为时间正序
请发表友善的回复…
发表回复
aotian798 2009-10-21
  • 打赏
  • 举报
回复
添加注册表
代码如下
RegistryKey ms_run = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
ms_run.SetValue("mistysoft", Application.ExecutablePath.ToString());
lyly1981826ly 2009-10-21
  • 打赏
  • 举报
回复
好好学习, 天天想上
美人心计1999 2009-10-21
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 nextpage 的回复:]
引用 3 楼 lorenliu 的回复:
引用 2 楼 miaojihao 的回复:
程序的快捷键拖到“开始”“程序” “启动”里面


Up


毛病,去死啊,两个傻b
[/Quote]
就这态度,
lp211564 2009-10-21
  • 打赏
  • 举报
回复



/// <summary>
/// 注册表操作,将程序添加到启动项
/// </summary>
static void SetRegistryKey()
{
try
{
Microsoft.Win32.RegistryKey Reg;
Reg = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Run", true);
Reg.SetValue("储存的名字", Application.ExecutablePath);
Reg.Close();
}
catch { }
}
flyerwing 2009-10-21
  • 打赏
  • 举报
回复
做个WINDOWS 服务设置为自动,再就是添加开始任务。
guyehanxinlei 2009-10-21
  • 打赏
  • 举报
回复
加入到任务当中去
llxzj60 2009-10-21
  • 打赏
  • 举报
回复
这态度还有人回答。。。汗。。。
maple0112 2009-10-21
  • 打赏
  • 举报
回复
[Quote=引用 18 楼 nextpage 的回复:]
引用 16 楼 miaojihao 的回复:
引用 4 楼 nextpage 的回复:
引用 3 楼 lorenliu 的回复:
引用 2 楼 miaojihao 的回复:
程序的快捷键拖到“开始”“程序” “启动”里面


Up


毛病,去死啊,两个傻b

就这态度,



回答的不好,就要骂,这是对他们好
[/Quote]


有错吗?还理直气壮,是你自己问题没问清楚,他们这样回答难道没达到你的目的嘛!!!
NextPage 2009-10-21
  • 打赏
  • 举报
回复
[Quote=引用 16 楼 miaojihao 的回复:]
引用 4 楼 nextpage 的回复:
引用 3 楼 lorenliu 的回复:
引用 2 楼 miaojihao 的回复:
程序的快捷键拖到“开始”“程序” “启动”里面


Up


毛病,去死啊,两个傻b

就这态度,
[/Quote]


回答的不好,就要骂,这是对他们好
elmnd 2009-10-21
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 aotian798 的回复:]
添加注册表
代码如下
  RegistryKey ms_run = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
                    ms_run.SetValue("mistysoft", Application.ExecutablePath.ToString());
[/Quote]
注册表操作, UP
LorenLiu 2009-10-21
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 nextpage 的回复:]
引用 3 楼 lorenliu 的回复:
引用 2 楼 miaojihao 的回复:
程序的快捷键拖到“开始”“程序” “启动”里面


Up


毛病,去死啊,两个傻b
[/Quote]

就这态度。。。
  • 打赏
  • 举报
回复
不知道的人飘过,我猜是改注册表 HOHO
Justin-Liu 2009-10-20
  • 打赏
  • 举报
回复
放启动项里被
fflyn 2009-10-20
  • 打赏
  • 举报
回复
学习中。。
zhujiazhi 2009-10-20
  • 打赏
  • 举报
回复
写一个window service,设置成开机时自动启动的,在service里再启动你的程序的
LorenLiu 2009-10-20
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 miaojihao 的回复:]
程序的快捷键拖到“开始”“程序” “启动”里面
[/Quote]

Up
美人心计1999 2009-10-20
  • 打赏
  • 举报
回复
程序的快捷键拖到“开始”“程序” “启动”里面
changyuming 2009-10-20
  • 打赏
  • 举报
回复
/// <summary>
/// 创建该程序的快捷方式到启动菜单
/// </summary>
private void SetThisToStart()
{
WshShell shell = new WshShell();
string StartupPath = System.Environment.GetFolderPath(System.Environment.SpecialFolder.Startup);
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(StartupPath + "\\app.lnk");
shortcut.TargetPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
shortcut.WorkingDirectory = System.Environment.CurrentDirectory;
shortcut.WindowStyle = 1;
shortcut.Description = "application";
shortcut.IconLocation = System.Environment.SystemDirectory + "" + "shell32.dll, 165";
shortcut.Save();
}
}

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧