@echo off
@echo.
@echo.
reg QUERY HKLM\SOFTWARE\Garmin\MapSource\Families\FAMILY_9365 2>NUL >NUL 
set uninstall=1 
if %errorlevel% EQU 1 set uninstall=fail 
reg QUERY HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource\Families\FAMILY_9365 2>NUL >NUL 
if %errorlevel% EQU 1 goto check 
:allright
@echo This batchfile will uninstall The following mapset from Mapsource and Basecamp
@echo.
@echo Map: "openmtbmap_contourlinesonly_austria"
@echo FID: "9365"
@echo PID: "1" 
@echo.
@echo.
@echo.
@echo Press any key to continue or Ctrl-C to abort
@echo.
pause >NUL 
@echo.
@echo.
@echo.
@echo.
@echo -------------Begin Uninstall-------------
@echo.
reg QUERY HKLM\SOFTWARE\Garmin\MapSource\Families\FAMILY_9365 2>NUL >NUL 
if %errorlevel% EQU 0 reg DELETE HKLM\SOFTWARE\Garmin\MapSource\Families\FAMILY_9365 /f 
reg QUERY HKLM\SOFTWARE\Garmin\MapSource\Families\FAMILY_9365 2>NUL >NUL 
if %errorlevel% EQU 0 echo Uninstallation failed - Please run this batch again with admin rights 
if %errorlevel% EQU 0 echo and/or for Windows Vista/7 or newer switch off User Account Controll (UAC) 
reg QUERY HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource\Families\FAMILY_9365 2>NUL >NUL 
if %errorlevel% EQU 0 reg DELETE HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource\Families\FAMILY_9365 /f 
reg QUERY HKLM\SOFTWARE\Wow6432Node\Garmin\MapSource\Families\FAMILY_9365 2>NUL >NUL 
if %errorlevel% EQU 0 echo Uninstallation failed - Please run this batch again with admin rights 
if %errorlevel% EQU 0 echo and/or for Windows Vista/7 or newer switch off User Account Controll (UAC) 
@echo.
@echo --------------END Uninstall--------------
@echo.
@echo.
@echo.
pause >NUL 
exit
:check
if %uninstall%==fail echo "No Openmtbmap.org map with FID: 9365 is currently installed. Uninstallation not possible"
if %uninstall%==1 goto allright
@echo.
@echo.
@echo.
pause >NUL 
exit
