SoFunction
Updated on 2025-03-06

C# sets the method of automatically running software on (modify the registry)

This article describes the method of setting the C# software to automatically run automatically when it is powered on. Share it for your reference, as follows:

#region
/// <summary>
/// Startup item/// </summary>
/// <param name="Started">Whether to start</param>/// <param name="name">Name of the startup value</param>/// <param name="path">Path to start the program </param>public static void RunWhenStart(bool Started, string name, string path)
{
  Microsoft. HKLM = Microsoft.;
  Microsoft. Run = (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
  if (Started == true)
  {
    try
    {
      (name, path);
      ();
    }
    catch { }
  }
  else
  {
    try
    {
      (name);
      ();
    }
    catch { }
  }
}
#endregion

For more information about C# related content, please check out the topic of this site:Summary of C# traversal algorithm and skills》、《Summary of thread usage techniques for C# programming》、《Summary of C# operation skills》、《Summary of XML file operation skills in C#》、《Tutorial on the usage of common C# controls》、《Summary of WinForm control usage》、《C# data structure and algorithm tutorial》、《Summary of C# array operation skills"and"Introduction to C# object-oriented programming tutorial

I hope this article will be helpful to everyone's C# programming.