WindowsAutostartApi 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package WindowsAutostartApi --version 1.0.0
                    
NuGet\Install-Package WindowsAutostartApi -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WindowsAutostartApi" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="WindowsAutostartApi" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="WindowsAutostartApi" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add WindowsAutostartApi --version 1.0.0
                    
#r "nuget: WindowsAutostartApi, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package WindowsAutostartApi@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=WindowsAutostartApi&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=WindowsAutostartApi&version=1.0.0
                    
Install as a Cake Tool

WindowsAutostartApi

Unified .NET API to manage Windows autostart entries:

  • Registry: HKCU/HKLM\Software\Microsoft\Windows\CurrentVersion\Run and RunOnce
  • Startup Folder: per-user and all-users (.lnk shortcuts)

Target Framework: .NET 8 (net8.0-windows)
OS: Windows only

Features

  • List all startup entries (Registry + Startup Folder)
  • Add or update entries (idempotent)
  • Remove entries
  • Clean, extensible design (providers)

Install

dotnet add package WindowsAutostartApi

Quick Start

using WindowsAutostartApi;

var mgr = new StartupManager();

// Add HKCU\Run entry
mgr.Add(new StartupEntry(
    Name: "MyCoolApp",
    TargetPath: @"C:\Tools\MyCoolApp.exe",
    Arguments: "--minimized",
    Scope: StartupScope.CurrentUser,
    Kind: StartupKind.Run));

// Add Startup Folder shortcut
mgr.Add(new StartupEntry(
    Name: "MyCoolApp (Shortcut)",
    TargetPath: @"C:\Tools\MyCoolApp.exe",
    Arguments: "--tray",
    Scope: StartupScope.CurrentUser,
    Kind: StartupKind.StartupFolder));

// List
foreach (var e in mgr.ListAll())
    Console.WriteLine($"{e.Scope} {e.Kind}: {e.Name} -> {e.TargetPath} {e.Arguments}");

// Remove
mgr.Remove("MyCoolApp", StartupScope.CurrentUser, StartupKind.Run);
mgr.Remove("MyCoolApp (Shortcut)", StartupScope.CurrentUser, StartupKind.StartupFolder);

API Surface

  • StartupEntry(string Name, string TargetPath, string? Arguments, StartupScope Scope, StartupKind Kind)

  • StartupScope: CurrentUser, AllUsers

  • StartupKind: Run, RunOnce, StartupFolder

  • IStartupManager:

    • IReadOnlyList<StartupEntry> ListAll()
    • bool Exists(string name, StartupScope scope, StartupKind kind)
    • void Add(StartupEntry entry)
    • void Remove(string name, StartupScope scope, StartupKind kind)

Permissions

  • HKCU: keine Admin-Rechte
  • HKLM (AllUsers): ben�tigt Administratorrechte (UAC Elevation)

32/64-bit Notes

  • Registry view defaults to 64-bit on 64-bit OS (RegistryView.Registry64).

Demo Project

A small console demo is included under samples/WindowsAutostartApi.Demo, but it is skipped by default during solution builds. Build/run it explicitly with:

dotnet run --project samples/WindowsAutostartApi.Demo -p:SkipBuild=false

Roadmap

  • Optional Task Scheduler provider (Logon trigger, delay, highest privileges)
Product Compatible and additional computed target framework versions.
.NET net8.0-windows7.0 is compatible.  net9.0-windows was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0-windows7.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 355 9/18/2025
1.0.1 334 9/18/2025
1.0.0 328 9/18/2025