Using command line parameters

Got a problem you cannot solve? Try here.
Post Reply
garyk
Posts: 27
Joined: Fri Jan 23, 2009 7:16 pm

Using command line parameters

Post by garyk »

Dear Michael
I would like to pass command line parameters to my installer, and make decisions based on these parameters.
The problem is that if I define the parameter (using Set Variable) it over rides any value given on the command line.
If I don't define the variable I get a compilation error because the variable is undefined.
The only workaround I found is using predefined command-line parameters because they exist without defining them.
But I can not realy use them for general purpuse parameters.
Is there a solution to this problem?
Thanks
Gary
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Using command line parameters

Post by MichaelNesmith »

That's an excellent question. Set Variable will not override your parameters if setup is being run silently (/s), otherwise it will.

You can still parse the command line using Parse String on the $CMDLINE$ pre-defined variable without having to rely on setting variable values.

Another interesting approach would be using Get INI File Settings to read an INI file for advanced configurability that wouldn't even require your end-users to mess with the command line!
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
garyk
Posts: 27
Joined: Fri Jan 23, 2009 7:16 pm

Re: Using command line parameters

Post by garyk »

Actually I found a better workaround which only requires one more line of code:
set variable A = $_A$
if $A$ Equal required-value
MessageBox $A$
End

On the command line I add: _A=required-value

It works but may I suggest you solve this for the next release.
Gary
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Using command line parameters

Post by MichaelNesmith »

This feature is as-designed but it appears you have devised an interesting workaround!

Does not using the pseudo-variable of $_A$ work elsewhere in the script also? Or do you get a complaint that the variable has not been defined?
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Post Reply