Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance uninstallation script and improve comments #4

Merged
merged 2 commits into from
Aug 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions Uninstall-Spotify.bat
Original file line number Diff line number Diff line change
@@ -1,34 +1,40 @@
@echo off

set a=0
set b=0
setlocal enabledelayedexpansion

REM Reset permissions for Spotify Update folder
if exist "%localappdata%\Spotify\Update" (
icacls "%localappdata%\Spotify\Update" /reset /T > NUL 2>&1
)

if exist "%appdata%\Spotify\Spotify.exe" (
set actions=0

REM Uninstall Spotify if it exists
if exist "%appdata%\Spotify\Spotify.exe" (
start "" /wait "%appdata%\Spotify\Spotify.exe" /UNINSTALL /SILENT
set /a b=%a% + 1
set /a actions+=1
)

timeout /t 1 > NUL 2>&1

if exist "%appdata%\Spotify" (
rd /s/q "%appdata%\Spotify" > NUL 2>&1
set /a b=%a% + 1
)
timeout /t 1 > NUL 2>&1

if exist "%localappdata%\Spotify" (
rd /s/q "%localappdata%\Spotify" > NUL 2>&1
set /a b=%a% + 1
REM Remove Spotify data folders
for %%d in ("%appdata%\Spotify" "%localappdata%\Spotify") do (
if exist "%%d" (
rd /s/q "%%d" > NUL 2>&1
set /a actions+=1
)
)

REM Delete SpotifyUninstall.exe if it exists
if exist "%temp%\SpotifyUninstall.exe" (
del /s /q "%temp%\SpotifyUninstall.exe" > NUL 2>&1
set /a b=%a% + 1
set /a actions+=1
)

if !actions! == 0 (
echo Spotify is not installed or not found
) else (
echo Spotify has been successfully uninstalled
)

if %b% == 0 echo Spotify not found
if %b% NEQ 0 echo Spotify removed
pause & exit