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");

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2022-12-23
  • 2021-10-20
  • 2022-12-23
  • 2021-10-03
  • 2022-12-23
  • 2021-07-26
猜你喜欢
  • 2021-07-09
  • 2021-07-29
  • 2021-06-09
  • 2021-11-29
  • 2021-11-30
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案