@echo off
echo.
if "%OS%"=="Windows_NT" goto :DIRECT
echo This batch works only on Windows 2000 or later.
goto :STOP

:DIRECT
SETLOCAL ENABLEEXTENSIONS
if DEFINED ProgramData (
 set ALL_DIR=%ProgramData%
 goto DISPLAY
)

set APP_DIR1=%APPDATA%
:LOOP
set APP_DIR2=%APP_DIR1%
for /F "tokens=1,* delims=\" %%i in ("%APP_DIR1%") do set APP_DIR1=%%j
if NOT "%APP_DIR1%" == "" goto LOOP
set ALL_DIR=%ALLUSERSPROFILE%\%APP_DIR2%

:DISPLAY
echo ====== Directories ===========================
echo.
echo %ALL_DIR%\Garmin\Maps
echo.
echo %APPDATA%\Garmin\Maps
echo.
echo.
echo ====== Maps ==================================
echo.
dir /A:D /B "%ALL_DIR%\Garmin\Maps\*.gmap" 2> NUL
dir /A:D /B "%APPDATA%\Garmin\Maps\*.gmap" 2> NUL
echo.
echo ==============================================

:STOP
echo.
ENDLOCAL
pause
