disable Spotify autostart

- a new parameter -DisableStartup has been added, which disables the auto-start of Spotify on Windows boot #632
This commit is contained in:
amd64fox
2024-09-19 01:40:10 +03:00
parent 5908ad228b
commit 55d452eb0e
+12
View File
@@ -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 }