@ECHO off
CD /d "%~dp0"
ECHO ===========================================================
ECHO  LICENSE.DAT CREATION BAT FILE. Clarivate Anaylytics 8/01/2018
ECHO ===========================================================

SET MSI=

REM ADD THE MSI FILES IN ORDER OF OLDEST TO NEWEST
FOR %%a IN (EndNote.msi ENX1Inst.msi ENX9Inst.msi EN20Inst.msi EN21Inst.msi EN25Inst.msi EN2025Inst.msi) DO (IF EXIST "%%a" SET MSI=%%a)

REM MSI WILL == "" IF THERE ARE NONE OF THOSE MSI FILES IN THE FOLDER
IF "%MSI%" NEQ "" GOTO EXECINSTALL

ECHO ERROR: UNABLE TO LOCATE AN ENDNOTE MSI INSTALLER FILE IN THIS FOLDER
PAUSE
GOTO END

:EXECINSTALL
ECHO USING THE FOLLOWING MSI: %MSI%
ECHO EXECUTING THE COMMAND  : msiexec /a "%MSI%"
msiexec /a "%MSI%"

:END
