rem *** Author: T. Wittrock, RZ Uni Kiel ***

if "%OS_VERSION%"=="" goto NoOSVersion

set WUA_VERSION_TARGET_MAJOR=5
set WUA_VERSION_TARGET_MINOR=8
set WUA_VERSION_TARGET_BUILD=0
set WUA_VERSION_TARGET_REVISION=2694

set MSI_VERSION_TARGET_MAJOR=3
set MSI_VERSION_TARGET_MINOR=1
set MSI_VERSION_TARGET_BUILD=0
set MSI_VERSION_TARGET_REVISION=0

set SCRIPT_VERSION_TARGET_MAJOR=5
set SCRIPT_VERSION_TARGET_MINOR=6
set SCRIPT_VERSION_TARGET_BUILD=0
set SCRIPT_VERSION_TARGET_REVISION=0

set IE_VERSION_TARGET_MINOR=0
set IE_VERSION_TARGET_BUILD=0
set IE_VERSION_TARGET_REVISION=0

goto %OS_VERSION%

:5.0
rem *** Windows 2000 ***
set OS_NAME=w2k
set OS_SP_VERSION_TARGET=4
set OS_SP_TARGET_ID=W2KSP4
set IE_VERSION_TARGET_MAJOR=6
goto SetOfficeName

:5.1
rem *** Windows XP ***
set OS_NAME=wxp
set OS_SP_VERSION_TARGET=2
set OS_SP_TARGET_ID=KB835935
if /i "%1"=="/instie7" (set IE_VERSION_TARGET_MAJOR=7) else (set IE_VERSION_TARGET_MAJOR=6)
goto SetOfficeName

:5.2
rem *** Windows Server 2003 ***
set OS_NAME=w2k3
set OS_SP_VERSION_TARGET=2
set OS_SP_TARGET_ID=KB914961
if /i "%1"=="/instie7" (set IE_VERSION_TARGET_MAJOR=7) else (set IE_VERSION_TARGET_MAJOR=6)
goto SetOfficeName

:6.0
rem *** Windows Vista ***
set OS_NAME=w60
set OS_SP_VERSION_TARGET=0
set OS_SP_TARGET_ID=KBxxxxxx
set IE_VERSION_TARGET_MAJOR=7
goto SetOfficeName

:SetOfficeName
if "%OFFICE_VERSION_MAJOR%"=="" goto EoF
goto Office%OFFICE_VERSION_MAJOR%

:Office9
rem *** Office 2000 ***
set OFFICE_NAME=o2k
set OFFICE_SP_VERSION_TARGET=3
set OFFICE_SP_TARGET_ID=O2kSp3
if %OFFICE_SP_VERSION% EQU 0 set O2K_PREC_SP_TARGET_ID=o2ksr1a
goto EoF

:Office10
rem *** Office XP ***
set OFFICE_NAME=oxp
set OFFICE_SP_VERSION_TARGET=3
set OFFICE_SP_TARGET_ID=KB832671
goto EoF

:Office11
rem *** Office 2003 ***
set OFFICE_NAME=o2k3
set OFFICE_SP_VERSION_TARGET=3
set OFFICE_SP_TARGET_ID=KB923618
goto EoF

:Office12
rem *** Office 2007 ***
set OFFICE_NAME=o2k7
set OFFICE_SP_VERSION_TARGET=0
set OFFICE_SP_TARGET_ID=KBxxxxxx
goto EoF

:NoOSVersion
echo ERROR: Environment variable OS_VERSION not set.
echo.
exit /b 1

:EoF
