用winform做一个程序,怎么让他开机自动自启动?而且杀毒软件不会检测到?

解决方案 »

  1.   

    将程序路径写到注册表 LocalMachine\software\microsoft\windows\currentversion\run 里面。
      

  2.   

    通过在Microsft.Win32命名空间的Registry可以在注册表中设置注册表项中的名称/值对的值。
    在注册表的"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"中
    存储应用程序名和路径可以实现程序的自启动
      

  3.   

    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;
      }
    keyName就是键名,是个字符串格式,随便你指定;filePath是要开机启动的可执行文件的路径,字符串格式(包含文件名,如:d:\1.exe)