zoukankan      html  css  js  c++  java
  • 我想把我写的c#程序随windows启动(开机启动), 我该怎么写呢

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

  • 相关阅读:
    MD5 Hashing in Java
    Caching in Presto
    ORC 文件存储格式
    Presto 性能优化点
    数据分页问题
    ES
    ES
    ES
    ES
    ES
  • 原文地址:https://www.cnblogs.com/hsapphire/p/1976964.html
Copyright © 2011-2022 走看看