@echo offsetlocal
SET ITShare=\\fileserver\share\cps12
SET CPSVersion=12.0.11
SER CPSUrl = http://appserver:9080/centricityps/cps
set IS_PRODUCT_ID={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}
set SETUP_PATH=InstallShield Installation Information\%IS_PRODUCT_ID%
ECHO Step 1 of 4:
ECHO Detecting installation of Centricity Practice Solution 12.
If NOT %PROCESSOR_ARCHITECTURE%==x86 goto x64
:x86
set regpath=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_%IS_PRODUCT_ID%
reg query "%regpath%" /v "InstallLocation" > NULL 2>&1
if NOT %ERRORLEVEL% == 0 goto errors
For /F "tokens=* delims=" %%A in ('reg query "%regpath%" /v "InstallLocation"') Do (
set CLIENT_PATH=%%A
)
set CLIENT_PATH=%CLIENT_PATH:~-53%
set CLIENT_PATH=%CLIENT_PATH%##
set CLIENT_PATH=%CLIENT_PATH: ##=##%
set CLIENT_PATH=%CLIENT_PATH:##=%
IF EXIST %ProgramFiles%\%SETUP_PATH%\setup.exe" (
ECHO CPS 12 detected. Removing previous version from this machine...
"%ProgramFiles%\%SETUP_PATH%\setup.exe" /w /s /f1"%CLIENT_PATH%\uninstall.txt"
)
goto INSTALL
:x64
set regpath=HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\InstallShield_%IS_PRODUCT_ID%
reg query "%regpath%" /v "InstallLocation" > NULL 2>&1
if NOT %ERRORLEVEL% == 0 goto errors
For /F "tokens=* delims=" %%A in ('reg query "%regpath%" /v "InstallLocation"') Do (
Set CLIENT_PATH=%%A
)
Set CLIENT_PATH=%CLIENT_PATH:~-62%
set CLIENT_PATH=%CLIENT_PATH%##
set CLIENT_PATH=%CLIENT_PATH: ##=##%
set CLIENT_PATH=%CLIENT_PATH:##=%
IF EXIST "%ProgramFiles(x86)%\%SETUP_PATH%\setup.exe" (
ECHO CPS 12 detected. Removing previous version from this machine...
"%ProgramFiles(x86)%\%SETUP_PATH%\setup.exe" /w /s /f1"%CLIENT_PATH%\uninstall.txt"
)
goto INSTALL
:errors
Echo No CPS client was found on this machine.
:INSTALL
SET CPSTempInstallDir=%SystemDrive%\cps%CPSVersion%
ECHO.
ECHO Step 2 of 4:
ECHO Preparing for CPS client upgrade.
ECHO Copying installation files to temporary directory...
robocopy /NS /NC /NP /NDL /NFL /NJH /NJS /MT /E /Z /R:10 /W:10 %ITShare%\cps%CPSVersion% %CPSTempInstallDir% /XF upgrade*.bat
ECHO Generating architecture-specific setup.iss.
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-DlgOrder] >> %CPSTempInstallDir%\setup.iss
ECHO Dlg0={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdWelcome-0 >> %CPSTempInstallDir%\setup.iss
ECHO Count=6 >> %CPSTempInstallDir%\setup.iss
ECHO Dlg1={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdAskDestPath-0 >> %CPSTempInstallDir%\setup.iss
ECHO Dlg2={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdShowDlgEdit1-0 >> %CPSTempInstallDir%\setup.iss
ECHO Dlg3={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdComponentDialog2-0 >> %CPSTempInstallDir%\setup.iss
ECHO Dlg4={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdStartCopy-0 >> %CPSTempInstallDir%\setup.iss
ECHO Dlg5={70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdFinish-0 >> %CPSTempInstallDir%\setup.iss
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdWelcome-0] >> %CPSTempInstallDir%\setup.iss
ECHO Result=1 >> %CPSTempInstallDir%\setup.iss
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdAskDestPath-0] >> %CPSTempInstallDir%\setup.iss
ECHO szDir=%ProgramFiles(x86)%\Centricity Practice Solution\Client\ >> %CPSTempInstallDir%\setup.iss
ECHO Result=1 >> %CPSTempInstallDir%\setup.iss
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdShowDlgEdit1-0] >> %CPSTempInstallDir%\setup.iss
ECHO szEdit1=%CPSUrl% >> %CPSTempInstallDir%\setup.iss
ECHO Result=1 >> %CPSTempInstallDir%\setup.iss
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdComponentDialog2-0] >> %CPSTempInstallDir%\setup.iss
ECHO Component-type=string >> %CPSTempInstallDir%\setup.iss
ECHO Component-count=1 >> %CPSTempInstallDir%\setup.iss
ECHO Component-0=CPSClient >> %CPSTempInstallDir%\setup.iss
ECHO Result=1 >> %CPSTempInstallDir%\setup.iss
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdStartCopy-0] >> %CPSTempInstallDir%\setup.iss
ECHO Result=1 >> %CPSTempInstallDir%\setup.iss
ECHO [{70B2D1A4-C3DE-460C-9A34-D9C42193EB42}-SdFinish-0] >> %CPSTempInstallDir%\setup.iss
ECHO Result=1 >> %CPSTempInstallDir%\setup.iss
ECHO bOpt1=0 >> %CPSTempInstallDir%\setup.iss
ECHO bOpt2=0 >> %CPSTempInstallDir%\setup.iss
ECHO.
ECHO Step 3 of 4:
ECHO Installing upgraded CPS client...
%CPSTempInstallDir%\setup.exe /w /s
REM ECHO Registering ActiveX plugin...
REM regsvr32 /s %CPSTempInstallDir%\MBCInstaller90.dll
REM ECHO Done.
ECHO.
ECHO Step 4 of 5:
ECHO Removing temporary installation files.
rmdir /s /q %CPSTempInstallDir%
ECHO.
ECHO Upgrade complete!
ECHO.
PAUSE
ECHO.
ECHO Step 5 of 5:
ECHO (5/5) Launching Centricity Practice Solution 12...
"%SystemDrive%\Users\Public\Desktop\CPS 12 Client.url"
EXIT