How to use external installer parameters?
April 30, 2008 1:34 PM   Subscribe

I'd like to make a Windows installer customizable via external parameters (e.g. from an installer.ini file).

The compiled installer will be distributed to multiple researchers, who will install the software on all client machines in their respective studies. The current installer sets a default value for the “StudyName” registry key, so the researchers would have to change it on each machine using RegEdit after install. I'd like to allow them to set the value before installing (e.g. by editing a text file) and have it override the default.

I have the existing Inno Setup source script, but I'd be glad to use another (free) installer package if Inno can't do it.
posted by danblaker to Computers & Internet (11 answers total) 1 user marked this as a favorite
 
If you can repackage this installation as an MSI file, you could make the StudyName a public property, which you could then set on the command line. Your installation command would wind up looking something like this:

msiexec /i X:\path\to\installer.msi STUDYNAME=YourValue
posted by JaredSeth at 2:13 PM on April 30, 2008


Looking at their site, it appears you can't do it with Inno Setup.

Do you have control of the application being installed? If so, maybe you can prompt for a value on start up if the registry key is still set to the default "StudyName" value, then set it the new value, and carry on with business.

WiX is free, but I've never used it. It generates MSI setups, so you'll be able to do pretty much whatever you want via custom actions. Or just prompt for the value in a dialog.
posted by ignignokt at 2:16 PM on April 30, 2008


Response by poster: I do have control of the application, but the people launching the app will be test subjects. At any rate, my goal is to have the researcher configure the parameters just once then use the same installer on each client computer.

I thought about using an MSI after seeing the MS App Compatibility Toolkit generate them on the fly, but I'm always nervous about using MS technology... I definitely want to avoid requiring command-line interaction (these researchers are not generally computer-savvy) but maybe a batch file would do the trick.
posted by danblaker at 3:07 PM on April 30, 2008


Have them run a .vbs file that will ask them a question e.g.

Set oShell = CreateObject("WScript.Shell")
Studyname = inputbox("What studygroup is this for?")
oSHell.Run "msiexec /i X:\path\to\installer.msi STUDYNAME=" & Studyname & " /L*v %TEMP%\installer.log", 1, 1

You really want the log file (the /L*v bit) for the install to see if different settings get captured in the MSI and into the registry.

Once you have that, open the MSI in camwood appeditor (or the free MSI editor of your choice), go to the Registry Table, find the key you want and replace the Value with [STUDYNAME]

This is already assuming you have an MSI and just want to customise one registry key.

Hope that helps!
posted by Admira at 3:23 PM on April 30, 2008


I think what you want to do is to distribute both the installer and a text file which may be edited by the researcher before making use of the installer ?

I believe NSIS (aka NullSoft Installer) can do what you want. Here is some example code to do (more or less) what you're describing.

By the way it's not what you're asking for but NSIS can also pick up command line parameters so that you could get the people using the installers to run it as ...

myinstaller.exe banana

... Example code for command line parameter is here

Aaaahh - hold on I've just re-read your question and you've already got an Inno script. OK you don't want to throw that away unless you really need to. On this page reference is made to the 'Inno Setup Preprocessor' and it's suggested that using that your installer can read from files etc. I have used Inno but I've never done that so I'm just reporting what it says on that page.

Good luck and don't lightly abandon INNO - I've just converted an installer from Inno to NSIS and it's not trivial (well it wasn't for me).
posted by southof40 at 3:26 PM on April 30, 2008


Response by poster: Thanks, southof40, that's exactly what I'm trying to do. I'll look into the Inno Setup Preprocessor. Mine is a pretty straightforward installer, so if Inno doesn't work out I'll look at NSIS (and keep your warning in mind).
posted by danblaker at 3:37 PM on April 30, 2008


Best answer: OK, MSI creation is off the table. I looked at the WiX toolset and it’s way over my non-programmer head. (The “Introduction” section of the help docs includes the following note: “This document assumes you have a working knowledge of the Windows Installer database format.” )

Inno Setup Preprocessor turns out to be useful for making easy installer changes at compile time; but unfortunately not at install time.

I did figure out a solution, though: After looking through the Inno forums (implemented as newsgroups fer crissakes!), it seems like my best bet is to have the app grab “StudyName” from a config file instead of the Registry. Inno allows me to install files external to the compiled installer, so I’ll distribute said config file and the researchers can edit it before installing.

Now that I’ve used it a bit more, I highly recommend the Inno Setup Quick Start Pack for anyone looking to create a Windows installer. It includes the Inno Setup compiler and ISTool visual IDE. Small, powerful and straightforward to use; why can’t more Windows software be like this?
posted by danblaker at 4:44 PM on April 30, 2008


More info, if you decide to investigate the MSI option.

Using WiXEdit, it would be pretty easy to put together an MSI install, especially since you'd have the Inno script as a guideline.

Excellent introduction to Wix (and good breakdown of Windows Installers in general) here if you'd like to check it out.
posted by JaredSeth at 5:24 PM on April 30, 2008


That'll teach me to preview...foiled again!
posted by JaredSeth at 5:25 PM on April 30, 2008


As an aside, my personal opinion is that Wix is a bad place to start for creating MSI files - many other MSI tools have very simple interfaces for creating MSI based installers (for example, many have a pre and post snapshot comparison, or GUI interfaces for dragging and dropping files/reg settings into an installer).
posted by Admira at 5:32 PM on April 30, 2008


I'd also be careful of Wixedit, it does some rather interesting things with component Guid creation (not that I support everything on the blog linked, I think what he highlighted about Wixedit is interesting).
posted by Admira at 6:00 PM on April 30, 2008


« Older How can I fix my Compaq Presario v5000 screen?   |   Comparing current node to previous node with XSLT... Newer »
This thread is closed to new comments.