From 55d452eb0e7233374fc9824f90d4b15c175ff61e Mon Sep 17 00:00:00 2001 From: amd64fox <62529699+amd64fox@users.noreply.github.com> Date: Thu, 19 Sep 2024 01:40:10 +0300 Subject: [PATCH] disable Spotify autostart - a new parameter -DisableStartup has been added, which disables the auto-start of Spotify on Windows boot #632 --- run.ps1 | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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 }