steed-zgf

 

【设置开机自启动】

 

using Microsoft.Win32;//添加命名空间

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; }

 

【取消开机自启动】

 

using Microsoft.Win32;//添加命名空间

public
static bool DeleteAutoRun(string keyName,string filePath) { try { RegistryKey runKey=Registry.LocalMachine.OpenSubKey(@"\SOFTWARE\Microsoft\Windows\CurrentVersion\Run",true); runKey.DeleteValue(keyName,filePath); runKey.Close(); } catch { return false; } return true; }

 

分类:

技术点:

相关文章:

  • 2021-12-15
  • 2021-12-14
  • 2022-12-23
  • 2021-11-23
  • 2021-12-09
  • 2022-01-03
  • 2022-02-25
猜你喜欢
  • 2021-11-30
  • 2021-11-29
  • 2021-11-30
  • 2022-02-28
  • 2022-12-23
  • 2021-12-15
相关资源
相似解决方案