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

     1  string KJQD = WebConfigurationManager.AppSettings["address"].ToString().Trim();
     2  //string KJQD = Application.ExecutablePath;  //两种方式
     3                 if (!System.IO.File.Exists(KJQD))//判断指定文件是否存在
     4                 {
     5                     MessageBox.Show("呼叫管理员!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
     6 
     7                     return;
     8                 }
     9 
    10                 string newKJLJ = KJQD.Substring(KJQD.LastIndexOf("\") + 1);
    11 
    12                 RegistryKey Rkey =
    13 
    14                     Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
    15 
    16                 if (Rkey == null)
    17 
    18                     Rkey = Registry.LocalMachine.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
    19 
    20                 Rkey.SetValue(newKJLJ, KJQD); 
    21                 MessageBox.Show("开机启动设置完毕!", "温馨提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
  • 相关阅读:
    2019-2020-1 20199302《Linux内核原理与分析》第九周作业
    MySQL 优化
    ElasticSearch实战
    redis实战
    ElasticSearch
    Zookeeper
    redis
    Jenkins 持续交付
    JDK 1.8 新特性之Stream
    cat-监控系统
  • 原文地址:https://www.cnblogs.com/liang-ling/p/3508800.html
Copyright © 2011-2022 走看看