@echo off

rem *********************************************************************************************************************
rem IBM InfoSphere Business Glossary Anywhere installation uses the Microsoft Windows Installer (Msiexec.exe). 
rem You can use this sample file as-is for a silent installation, or you can add additional functionality to this script.
rem For example, you can add more error checking by using additional msiexec.exe error codes.
rem By default IBM InfoSphere Business Glossary Anywhere is installed in the local app data directory. In Windows 7 it 
rem is by default: 
rem C:\Users\username\AppData\Local\IBM\Business Glossary Anywhere\Application
rem To change the installation directory, for example, to a directory local to the logged in user,
rem add in the end the parameter TARGETDIR="c:\YourFolder..."
rem *********************************************************************************************************************

echo Installing IBM InfoSphere Business Glossary Anywhere...
rem Important: You must include the DefaultConfigSettings parameter and point it to the config.ini file if you want the
rem settings in config.ini to apply to this installation.
rem The line below installs to the directory C:\Users\username\AppData\Local\IBM\Business Glossary Anywhere\Application. 
rem You can change this by specifying a target directory (see commented alternative version later in this file).

start /wait msiexec.exe /i BGAInstaller.msi /quiet /l*e BGAInstall.log DefaultConfigSettings="%cd%\config.ini"

rem To change the installation directory, uncomment the line below that begins with "start" and comment the line above 
rem The line below installs to <user profile directory>/ibm/bga.You can change the value of the target directory, including
rem using other environment variables.

rem start /wait msiexec.exe /i BGAInstaller.msi /quiet /l*e BGAInstall.log DefaultConfigSettings="%cd%\config.ini" TARGETDIR="%userprofile%\ibm\bga"

rem Handling only "already installed" error here, but more errors can be handled this way. 
rem See the documentation for the Windows Installer (Msiexec.exe) from Microsoft for more error codes.
if "%errorlevel%" == "0" goto OK
if "%errorlevel%" == "1638" goto alreadyInstalled
rem All other errors will display this message.
echo There was an error during installation.
goto err

:OK
echo Installed successfully.
goto end

:alreadyInstalled
echo IBM InfoSphere Business Glossary Anywhere is already installed.
goto err

:err
echo See BGAInstall.log for details.
goto end

:end