Feedback

Autostart-Eintrag hinzufügen (RegistryKey)

Sprache: C#

Fügt einen neuen Autostart-Eintrag mit Name und Pfad in die Registry ein.
public static void addAutoStartRegistry(string appName, string appPath)
        {
            string run = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
            string AppName = appName;
            string AppPath = appPath;
            if (Path.HasExtension(appPath))
            {
                RegistryKey startKey = Registry.LocalMachine.OpenSubKey(run, true);
                startKey.SetValue(AppName, AppPath);
            }
        }
public static void addAutoStartRegistry(string appName, string appPath)
        {
            string run = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
            string AppName = appName;
            string AppPath = appPath;
            if (Path.HasExtension(appPath))
            {
                RegistryKey startKey = Registry.LocalMachine.OpenSubKey(run, true);
                startKey.SetValue(AppName, AppPath);
            }
        }