SoFunction
Updated on 2025-03-07

C# method to start the program

This article describes the method of starting a program by C#. Share it for your reference, as follows:

//This method loads the startup item into the registry//Get the application pathstring strAssName =  + @"\" +  + @".exe";
//Get the application namestring ShortFileName = ;
RegistryKey rgkRun = ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (rgkRun == null)
{
  rgkRun = ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
}
(ShortFileName, strAssName);
//This deletes the startup item in the registry//Get the application namestring ShortFileName = ;
RegistryKey rgkRun = ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (rgkRun == null)
{
  rgkRun = ("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
}
(ShortFileName, false);

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

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