A library that makes your app launch automatically when the user logs in to Windows. It respects the user turning it off in Task Manager's Startup apps.
Create one for your app:
var startupApp = new StartupApp(YOUR_APP_NAME);Add it to the user's startup apps, turned on:
startupApp.TurnOn();In your installer or updater, add it or update its command, without undoing the user turning it off:
startupApp.AddToStartupApps(/*optional path to exe*/);In your settings UI, check whether it's on:
var isOn = startupApp.IsOn;
//...Turn it off, the way Task Manager does:
startupApp.TurnOff();Remove it entirely, for example in your uninstaller:
startupApp.RemoveFromStartupApps();If you install and update your app with Velopack, add the LaunchAtLogin.Velopack package and register its hooks:
VelopackApp.Build()
.KeepInStartupApps(new StartupApp(YOUR_APP_NAME))
.Run();It adds your app to the startup apps when Velopack installs it, turned on. After each update it rewrites the command, without undoing the user turning it off. It removes your app when Velopack uninstalls it. Your own Velopack hooks still run.
Don't also use Velopack's --shortcuts Startup option: it puts a second entry in the Startup folder, so your app launches twice.
No existing NuGet package does this. These were checked, by reading their source or unzipping the package, in November 2026:
| Package | What it does | Why it doesn't fit |
|---|---|---|
| WindowsAutostartApi, AutostartManager, BootMeUp, RunOnStartup, StartupHelper | Write the Run value or a Startup folder shortcut |
Never read or write StartupApproved |
| BlackSharp.Platform.Startup | Uses Task Scheduler | Task Manager's switch doesn't apply to scheduled tasks |
Shiny.Core (AppStartupInstaller, 6.6 beta only) |
Reads the switch correctly | Can't turn an app off the way Task Manager does, and pulls in dependency injection, logging and other packages |
DevWinUI (StartupHelper) |
Writes the switch | Its "off" marker is all zeros, which Windows reads as on |
| ManagedShell | Reads the switch | Only to launch other apps, as a shell replacement |
A Windows desktop app that offers "launch at login" usually writes a value under HKCU\Software\Microsoft\Windows\CurrentVersion\Run.
Windows also keeps a second, separate record: the on/off switch shown in Task Manager's Startup apps tab and in Settings > Apps > Startup.
That switch lives in HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run.
When the user turns an app off there, Windows leaves the Run value alone and writes a binary marker under StartupApproved\Run instead.
Apps that only look at the Run value get two things wrong:
- They show "on" in their own settings while Task Manager shows "off".
- When their installer or updater rewrites the
Runvalue, some of them also clear the switch, which turns the app back on against the user's choice.
This library handles both records together, so an app's own setting and Task Manager always agree, and the user's choice survives installs and updates.
The thing no other package does is turn an app off exactly the way Task Manager does, so the app still appears in Task Manager's list, marked Disabled.
- Install the .NET SDK.
- Run
build-and-test.cmd.
To check that launching at login really works, run the end-to-end test. It needs you to log out and back in.
- Packaged (MSIX) apps. Windows redirects their HKCU writes into a private copy, so a Run value they write does nothing. They should use the
windows.startupTaskmanifest extension and theStartupTaskAPI instead. - All users (HKLM). It needs administrator rights, and Windows keeps a separate switch for it.
- 32-bit apps on 64-bit Windows (
Run32) and Startup folder shortcuts. They use differentStartupApprovedsubkeys. - Command-line arguments.
AddToStartupAppsandTurnOnwrite only the quoted exe path. If a later version adds arguments, it needs Windows' command-line quoting rules (those ofCommandLineToArgvW). - Opening the Startup apps settings page. An app can do that itself with
Process.Start(new ProcessStartInfo("ms-settings:startupapps") { UseShellExecute = true }); the README can show that.