I'm teaching someone better practices by refactoring a large project they worked on. One of the current functions of the application is the option to have the application start when Windows starts. Currently, the application accomplishes this using the Run registry key:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
I haven't had the need to implement this feature before, so I'm not sure if this is the "best" way to make an application run at startup. Is access to this registry key something that most users will have?
Would it be better instead to place a shortcut to the application in the folder indicated by Environment.GetFolderPath(SpecialFolder.Startup)
? It seems that creation of shortcuts from .NET is kind of hacky, so I'm not certain this is better.
edit:
From current responses it's clear that I left out something important. The "start with windows" behavior is optional and part of the options dialog for the program. It's valid (though silly) for the user to toggle it several times while using the application.