c#   开机自启动
winform程序中  如何添加代码,让软件在开机后自启动???
------解决方案--------------------RegistryKey key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);//打开注册表子项 
key.SetValue(程序的名称, 程序的路径);
或
WshShell shell = new WshShell();  
IWshShortcut shortcut = (IWshShortcut)shell.CreateShortcut(shortcutPath);  
------解决方案--------------------写注册表,或者生成一个快捷方式文件,写到 开始,程序,启动对应的目录下面
------解决方案--------------------修改注册表
添加Windows计划任务
------解决方案--------------------这个跟什么语言没有关系,Windows中什么语言写的基本都是操作注册表,可以向的五个自启动位置的任意一个添加值
或者是设置系统服务,自启动
------解决方案--------------------
------解决方案--------------------开机自动启动程序的函数:
public void SetAutoRun(string fileName, bool isAutoRun) 
{ 
   RegistryKey reg = null; 
   try 
   { 
       if (!System.IO.File.Exists(fileName)) 
           throw new Exception("该文件不存在!"); 
       String name = fileName.Substring(fileName.LastIndexOf(@"\") + 1); 
       reg = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true); 
       if (reg == null) 
           reg = Registry.LocalMachine.CreateSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run"); 
       if (isAutoRun) 
           reg.SetValue(name, fileName); 
       else 
           reg.SetValue(name, false); 
       lbl_autorunerr.Visible = false; 
   } 
   catch 
   { 
       lbl_autorunerr.Visible = true; 
       //throw new Exception(ex.ToString()); 
   } 
   finally 
   { 
       if (reg != null) 
           reg.Close(); 
   } 
}   
使用的时候,直接调用SetAutoRun函数即可,这里解释一下两个参数的含义:
fileName:需要设置自动启动程序的路径,若为当前程序可直接传递Application.ExecutablePath。
isAutoRun:是否自动运行,为false时,取消自动运行。
例:  SetAutoRun(Application.ExecutablePath, true);  //设置自动启动当前程序
     SetAutoRun(Application.ExecutablePath, false);  //取消自动启动
------解决方案--------------------方法有很多 如果楼主的程序是正当的(你懂我的意思)可以这样:
复制程序-》粘贴程序到“C:\Documents and Settings\Administrator\「开始」菜单\程序\启动”目录下-》搞定
恩 具体编程嘛 就是比如c#:
API 中的CopyFile函数搞定。
取消自启动嘛更简单 删掉OK.
------解决方案--------------------将软件写成windows服务程序
------解决方案-------------------- 生成一个服务最好了。因为服务不需要登录也可以启动,要是放在开始-程序的启动里面的话,一定要登录操作系统才会启动。
------解决方案--------------------我都是直接操作注册表的