Setup Script for the Updater

After the update is downloaded, the Updater simply executes the downloaded file to install the update. Besides, the Updater allows you to include script files to perform additional tasks needed in the update process such as uninstalling the previous version. The script files can be VBScript (.vbs), batch (.bat), or any executable file. These files must be placed in the same directory as the Updater, under the following folder:

 

UPDSHLSCR\ (e.g. Updshlsrc\Inst.bat)

 

When the update is downloaded successfully and ready to be installed, the Updater copies the script files to the downloaded update file location and then executes the script files.

 

You can specify a setup script file to the Updater by using UpdateShield Builder. From the Updater / Updater Properties tab, under Runtime Settings, select the Run the Command Line radio box. Then, enter the script file name with its parameters in the Command Line edit box (e.g. Inst.bat [AppDir]). If you have additional script files, you can place them in the UPDSHLSCR\ folder.

 

In case of the Online Installer, you can specify the script files by using UpdateShield Builder. From the Updater / Online Installer tab, under Embedded Scripts, you can specify the script files to be embedded into the Online Installer.

 

The following is a sample batch file that uninstalls the previous version of the application, and then runs the downloaded update file (Setup.exe) to install the new version.

 

@ECHO OFF

IF NOT EXIST Setup.exe GOTO END

ECHO Uninstalling the previous version ...

Msiexec.exe /x {01234567-89AB-CDEF-0123-456789ABCDEF} /quiet /passive

IF ERRORLEVEL 0 GOTO INSTALL

ECHO Uninstallation Error!

PAUSE

GOTO END

:INSTALL

ECHO Installing the update ...

Setup.exe

:END

 

noteNOTE: During your development phase, it is recommended that you delete any existing script file before starting a new test. From the Windows system tray, you can right-click on the Updater icon and select Delete Temporary Files from the context menu.

See Also

         UpdateShield System Files

         Updater Command Usage

         Index Files

         Customizing the Updater UI

         Interfacing with ElecKey