Novell Home

SETUP.EXE Command Line Switches, and a Special Trick

Novell Cool Solutions: Trench
By Bryan Keadle

Rate This Page

Reader Rating  stars  from 8 ratings

Digg This - Slashdot This

Posted: 6 Jan 2005
 

Installing applications via an .MSI is handy when you can make a transform file (.MST) to modify the way the install behaves. However, some programs use SETUP.EXE to install, which might point to an .MSI, but you can't create a transform file for them (older MSI technology?).

I found, though, that you can create an answer file for these kind of setups, and use the answer file to silently distribute the application. Here's what you do:

"MyApp" application Object:

  1. Copy the install directory structure to your NAL distribution directory:
    xcopy R:\*.* \\server\vol1\nals\thisapp /s/i


  2. From this directory run the install with a /r switch:
    setup /r


  3. When done, copy the (windir)\setup.iss file to your NAL distribution directory:
    copy c:\winnt\setup.iss \\server\vol1\nals\thisapp\mysetup.iss


  4. Now create an application distribution object:
    Run Options tab:, Application:
    Path to file: %SOURCE_PATH%\setup.exe
    Parameters: /s /f1"%SOURCE_PATH%\mysetup.iss"

Though this will "silently" install the application, you'll need to modify the changes it makes either through the "Launch Scripts: Run after Termination" item under the Run Options, or create another object ("MyApp_Mods") that makes the necessary modifications to the install, and have an application dependency to the first distribution object, "MyApp".

For example, we have a program that we distribute like this, but we don't want any of the shortcuts to remain on the Start Menu after the install (we'll provide the shortcuts via NAL (red-arrow shortcuts), though we do want to "bury" the shortcuts from the install under the Target folder so that we *could* manually launch the program in the event the red-arrow shortcuts aren't available for some reason.

So in the "Launch Scripts: Run after Termination" item under the Run Options, we add:

@echo off
	md "%TARGET_PATH%\Shortcuts"
	xcopy "%*CommonPrograms%\MyApp" "%TARGET_PATH%\Shortcuts" /s /y /i>nul
	rd "%*CommonPrograms%\MyApp" /s/q

This will effectively *move" the MyApp folder containing the install's shortcuts to a subdirectory under the %TARGET_PATH% of the install.

However, on one particular setup, we found that the SETUP.EXE appears to terminate before the install is complete - in fact, before it even gets started! So the SETUP.EXE is calling some other process to complete the installation. We needed a way to wait for the installation to complete, before we run our termination script to move the shortcut folder. So, we just added to our termination script to wait for one of the last files in the setup process to appear before we move the folder:

@echo off
	:LOOP
	cls
	echo.
	echo Waiting for MyApp install to complete...
	echo (this can take a while...please be patient!)
	choice /c:cq /n /t:c,05
	if errorlevel 2 goto :END
	if NOT exist "%TARGET_PATH%\install.log" goto :LOOP
	md "%TARGET_PATH%\Shortcuts"
	xcopy "%*CommonPrograms%\MyApp" "%TARGET_PATH%\Shortcuts" /s /y /i>nul
	rd "%*CommonPrograms%\MyApp" /s/q
	:END

(Note: for these scripts, the script engine entry is "cmd /c" and the extension for the script file is ".bat")

Now are chained installs are "paced" correctly.

Reader Comments

  • The fact that the author speculates an InstallShield setup.exe is an older MSI technology scares me. Yes, you can script InstallShield setups, but that's certainly not every setup.exe, and it's certainly not related to MSIs.
  • Nice idea on looping while looking for one of the files to appear. We have seen that behavior as well and I think this will work nicely. Another thing we have done is write a .vbs script and launch the setup.exe using the wshshell.run and set the waitonreturn value to True. This works fairly well and you can then write the script file to delete any extra icons you want. We have had to use the /r option many times. I can't imagine using Zenworks without it.
  • you can also check you temp directory when the install startup, in there you just may find the complete msi install and can get rid of the setup.exe all together

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2008 Novell, Inc. All Rights Reserved.