File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -1827,13 +1827,36 @@ if ([version]$offline -ge [version]"1.1.87.612" -and [version]$offline -le [vers
1827
1827
Get - Url (Get-Link - e " /res/login.spa" ) - OutputPath $login_spa
1828
1828
}
1829
1829
1830
+ # Disable Startup client
1830
1831
if ($DisableStartup ) {
1832
+ $prefsPath = " $env: APPDATA \Spotify\prefs"
1831
1833
$keyPath = " HKCU:\Software\Microsoft\Windows\CurrentVersion\Run"
1832
1834
$keyName = " Spotify"
1833
1835
1836
+ # delete key in registry
1834
1837
if (Get-ItemProperty - Path $keyPath - Name $keyName - ErrorAction SilentlyContinue) {
1835
1838
Remove-ItemProperty - Path $keyPath - Name $keyName - Force
1836
1839
}
1840
+
1841
+ # create new prefs
1842
+ if (-not (Test-Path $prefsPath )) {
1843
+ $content = @"
1844
+ app.autostart-configured=true
1845
+ app.autostart-mode="off"
1846
+ "@
1847
+ [System.IO.File ]::WriteAllLines($prefsPath , $content , [System.Text.UTF8Encoding ]::new($false ))
1848
+ }
1849
+
1850
+ # update prefs
1851
+ else {
1852
+ $content = [System.IO.File ]::ReadAllText($prefsPath )
1853
+ if (-not $content.EndsWith (" `n " )) {
1854
+ $content += " `n "
1855
+ }
1856
+ $content += ' app.autostart-mode="off"'
1857
+ [System.IO.File ]::WriteAllText($prefsPath , $content , [System.Text.UTF8Encoding ]::new($false ))
1858
+ }
1859
+
1837
1860
}
1838
1861
1839
1862
# Start Spotify
You can’t perform that action at this time.
0 commit comments