Windows Batch Scripts

453 Views Asked by At

I have written a windows batch command as follows to install a application silently

msiexec /q /i ZFPSetup.msi WIXUI_INSTALLDIR="C:\GEHC\" TARGETVDIR="ZFP" WIXUI_EXITDIALOGOPTIONALCHECKBOX=1 /l*v "C:\gehc\log.txt"

but there is a batch file in that application folder which should run at the time of installation. what should i add to above command inorder to invoke that batch file. as if that batch file doesnt run, the installation is not successfull.

2

There are 2 best solutions below

7
Bali C On

Call the batch file by putting this on the line below

call youruninstaller.bat
2
weberik On

Lets asume your MSI file is in "c:\GEHC" and the application is installed in "c:\program files\ZFP" try this batch:

    start /wait msiexec /q /i c:\ZFPSetup.msi WIXUI_INSTALLDIR="C:\GEHC\" TARGETVDIR="ZFP" WIXUI_EXITDIALOGOPTIONALCHECKBOX=1 /l*v "C:\gehc\log.txt"

call "c:\program files\ZFP\abc.bat"

you can add errorhandling like this:

if errorlevel neq 0 echo ERROR

but you have to place errorhandlers right after every command you use in your batch. you could also check if the batch file exists, if it doesnt, you can asume that the msi didnt install correctly:

if not exist "c:\program files\ZFP\abc.bat" echo ERROR

get get more examples type 'if /?' in a cmd