@echo off
 
call :confirm
if "%yesno%"=="6" (
call :remove
) else (
call :cancel
)
exit /b
 
:confirm
::returns 6 = Yes, 7 = No.
set yesno=
echo wscript.echo MsgBox("Do you want to uninstall TextSweep?", vbYesNo+vbInformation, "Uninstall") > %temp%\confirm.vbs
for /f "tokens=* delims=" %%a in ('cscript //nologo "%temp%\confirm.vbs"') do set yesno=%%a
del %temp%\confirm.vbs /f /q
exit /b
 
 
:remove
reg delete "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\TextSweep.exe" /f
reg delete  "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\TextSweep" /f
 
rmdir "%appdata%\Microsoft\Windows\Start Menu\TextSweep" /s /q 
echo MsgBox "Uninstallation of TextSweep is complete.", vbOKOnly+vbInformation, "Uninstall"> %temp%\remove.vbs
call %temp%\remove.vbs
del %temp%\remove.vbs /f /q
rmdir %appdata%\TextSweep_App /s /q
start /b "" cmd /c rmdir "%appdata%\TextSweep\" /s /q && exit
 
 
:cancel
echo MsgBox "Uninstallation of TextSweep cancelled.",vbOKOnly+vbInformation, "Uninstall TextSweep"  > %temp%\cancel.vbs
call %temp%\cancel.vbs
del %temp%\cancel.vbs /f /q
exit /b
