@echo off
set source=%~dp0Update64
set target=C:\Program Files (x86)\Rethinkit\Mailscavator
echo -----------------------------------------------------------------------------
echo - %~nx0            Computer:%computername% User:%username%
echo - 
echo - Update installed version of Mailscavator
echo - 
echo - From 32 bit to 64 bit
echo - 
echo - Source: %source%
echo - Target: %target%
echo - 
echo - (bitness refers to Outlook bitness, not Windows bitness)
echo -----------------------------------------------------------------------------
:: check admin
net session >nul 2>&1
if %errorLevel% == 0 (echo [Admin confirmed]) else (echo ERR: Admin denied. Right-click and run as administrator. & pause & goto :EOF)
:: check admin
if not exist "%target%\*.*" goto :NOTARGET
if not exist "%source%\*.*" goto :NOSOURCE
echo Press  Ctrl-C to abort    . . .
pause
echo [Copying]
copy "%source%\*.*" "%target%"
echo [Registering DLLs]
call "%target%\Redemption_Register.cmd" -quiet
goto :DONE

:NOSOURCE
echo -----------------------------------------------------------------------------
echo Couldn't find update source:
echo %source%
echo Before running this updater, first install Mailscavator 32 bit
goto :DONE

:NOTARGET
echo -----------------------------------------------------------------------------
echo Couldn't find installed Mailscavator to update:
echo %target%
echo Before running this updater, first install Mailscavator 32 bit
goto :DONE

:DONE
echo -----------------------------------------------------------------------------
echo Done updating Mailscavator to 64 bit.
pause