using Microsoft.Win32; namespace ClinicBackupSync; static class StartupRegistration { const string ValueName = "ClinicBackupSync"; public static void Ensure() { var executable = Environment.ProcessPath; if (string.IsNullOrWhiteSpace(executable)) { return; } using var key = Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run", writable: true); key?.SetValue(ValueName, $"\"{executable}\""); AppLog.Write($"Registered to start with Windows: {executable}"); } }