Skip to content

Commit

Permalink
disable Spotify autostart
Browse files Browse the repository at this point in the history
- a new parameter -DisableStartup has been added, which disables the auto-start of Spotify on Windows boot #632
  • Loading branch information
amd64fox committed Sep 18, 2024
1 parent 5908ad2 commit 55d452e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions run.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 }

Expand Down

0 comments on commit 55d452e

Please sign in to comment.