:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Setting Parameters
Set Destination=%ProgramFiles%\SIX Payment Services Ltd
Set TraceDestination=%SystemDrive%\Trace
Set Other=/NoProbe /AutoStart
Set NoSerialPortScan=/NoSerialPortScan


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: Testing Administartive permissions
@echo off
cls
ECHO.
Echo Administrative permissions required. Detecting ...

Net Session >nul 2>&1
If %errorLevel% == 0 (
   Echo Success: Administrative permissions confirmed.
   goto Install
) else (
   COLOR 0C
   ECHO.
   ECHO.
   ECHO.ERROR: Logged-on user does not have administrative privilege!
   ECHO.
   ECHO.Logon as administrator or try right click on %0 and select 'Run as administrator'
   ECHO.
   ECHO.
   PAUSE
   COLOR 07 
   cls
   Exit /B 1
)


:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: starting installation
:Install
CD /D "%~dp0"

@echo off

Set /p Version= < version.srv

Set ServiceDisplayName=SIX MPD(Multi Protocol Driver)

Set TID=%1



@echo on


Set StartUpParameter=%Other% %NoSerialPortScan% /TraceDir %TraceDestination% %TID%

net stop eftmpd
".\%Version%\Windows\eftdvs.exe" /UnRegServer
sc delete eftmpd 
rmdir "%Destination%" /s/q
rmdir "%TraceDestination%" /s/q

Set TID=
Set Destination=
Set Other=
Set NoSerialPortScan=
Set StartUpParameter=
Set Version=

pause
