Page 1 of 1

Using command line parameters

Posted: Tue Jun 08, 2010 5:22 am
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

Re: Using command line parameters

Posted: Tue Jun 08, 2010 5:21 pm
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!

Re: Using command line parameters

Posted: Wed Jun 09, 2010 2:33 am
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

Re: Using command line parameters

Posted: Wed Jun 09, 2010 4:06 am
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?