zoukankan      html  css  js  c++  java
  • C# 开机自动启动

           if (ConfigurationManager.AppSettings["IsBoot"].ToString().Trim().ToUpper() == "TRUE")
                {
                    //设置开机启动
                    string path = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                    RegistryKey rk = Registry.LocalMachine;
                    RegistryKey rk2 = rk.CreateSubKey(@"SoftwareMicrosoftWindowsCurrentVersionRun");
                    rk2.SetValue("JcShutdown", path);
                    rk2.Close();
                    rk.Close();
    
                }
                else
                {
                    string path = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
                    RegistryKey rk = Registry.LocalMachine;
                    RegistryKey rk2 = rk.CreateSubKey(@"SoftwareMicrosoftWindowsCurrentVersionRun");
                    rk2.DeleteValue("JcShutdown", false);
                    rk2.Close();
                    rk.Close();
                }

    App.Config:

      <!--是否开机启动 TRUE 启动 FALSE 禁止-->
      <add key="IsBoot" value="FALSE"/>

    
    

      

     
  • 相关阅读:
    flash
    应用缓存
    音频和视频
    拖拽借口
    地理定位接口
    表单元素
    jquery常见用法
    jquery ajax 模板
    Ubuntu下Lucene环境搭配
    小絮叨
  • 原文地址:https://www.cnblogs.com/haibing0107/p/7750291.html
Copyright © 2011-2022 走看看