Rajkumar G
Rajkumar G

Reputation: 247

Passing config file to MSI as argument and need to use it by Custom action with Silent Installation

I have created Basic MSI Project for creating installer for my project in Installshield 2014 and it is working fine. I have also created a custom action to execute my exe file while installing the application.

Then i create a Silent Installer using (/s) command line argument. I want to pass the Config file to my MSI setup and one of my Custom Action exe file need this Config file to setup basic project setup.

e.g

Installer.msi /s "c:\project\config.txt"

How to pass this config file parameter to my exe as command line argument? I have searched in google and existing questions also. I didn't get way to do this. Till now i didn't get any way to do this. Please anyone help me to do this.

Thanks in advance.

Upvotes: 4

Views: 20080

Answers (2)

Philm
Philm

Reputation: 3674

Yes, Glytzhkof is right. According to your question, you are free to "invent" an own property e.g. CONFIGFILE and pass on the commandline something like CONFIGFILE="C:\myconfig.ini" or something similar. If the path is always the same (e.g. in SOURCEDIR), you can avoid the whole path and add it in your code, but don't rely on the source for a patch (.msp) for example.

I am not sure if I understand, what you mean exactly with "silent installer". You can call every msi setup with the parameter "/qn" (or "/quiet") silently. The "/s" parameter does not belong to MSI, but is more common for setup.exe files (bootstrappers) or InstallShield script projects. Of course you can combine a bootstrapper with a MSI called.

For example, using the InstallShield built setup.exe could be something like:

setup.exe /s /v "/qn CONFIGFILE=myconfig.ini"

Upvotes: 0

Stein Åsmul
Stein Åsmul

Reputation: 42136

You can pass values to your MSI by command line. This is one way to pass values straight into your MSI, another way is using a transform to modify the MSI. See this answer: Using msiexec.exe custom command lines, or using transform files.

As far as I know there is no limit to how many values you can pass by command line:

msiexec.exe /I "C:\Install.msi" /QN /L*V "C:\msilog.log" STARTAPP=1 FIREWALLRULE="Long string here"

Quick explanation of command line above:

/L*V "C:\msilog.log"= verbose logging
/QN = run completely silently
STARTAPP="1" = Your property indicating the app should be started after install 
FIREWALLRULE="Long string here" = Your firewall rule to apply via a custom action

Upvotes: 3

Related Questions