diff --git a/run.ps1 b/run.ps1 index ebbc224..21b87ca 100644 --- a/run.ps1 +++ b/run.ps1 @@ -45,6 +45,9 @@ param [Parameter(HelpMessage = 'Installation without ad blocking for premium accounts.')] [switch]$premium, + + [Parameter(HelpMessage = 'Disable Spotify autostart on Windows boot.')] + [switch]$DisableStartup, [Parameter(HelpMessage = 'Automatic launch of Spotify after installation is complete.')] [switch]$start_spoti, @@ -1824,6 +1827,15 @@ if ([version]$offline -ge [version]"1.1.87.612" -and [version]$offline -le [vers Get -Url (Get-Link -e "/res/login.spa") -OutputPath $login_spa } +if ($DisableStartup) { + $keyPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Run" + $keyName = "Spotify" + + if (Get-ItemProperty -Path $keyPath -Name $keyName -ErrorAction SilentlyContinue) { + Remove-ItemProperty -Path $keyPath -Name $keyName -Force + } +} + # Start Spotify if ($start_spoti) { Start-Process -WorkingDirectory $spotifyDirectory -FilePath $spotifyExecutable }