When reading the documentation about how to set a variable at the command line it looks simple.
But my problem is that I can't use the variable with a If statment, if I do that I get an error while compiling that says that the variable is not defined.
But if I defind it with a set command it will override what my user specified at the command line.
I guess I am missing something, can some one please help me?
Zims
Using variables set from the command line
I found this topic:
http://www.installaware.com/forums/view ... e+variable
Which suggests using:
Set Variable COMMANDLINE to $CMDLINE$
If COMMANDLINE contains (ignore case) MYPARAMETER=
Set MYPARAMETER=$MYPARAMETER$
Else
Set MYPARAMETER=
End
Ok, this might work, but it does not feel logical. There must be a more straigt forward way.
I guess almost all custom variables that you set from the commandline will be used in a if statement.
Zims
http://www.installaware.com/forums/view ... e+variable
Which suggests using:
Set Variable COMMANDLINE to $CMDLINE$
If COMMANDLINE contains (ignore case) MYPARAMETER=
Set MYPARAMETER=$MYPARAMETER$
Else
Set MYPARAMETER=
End
Ok, this might work, but it does not feel logical. There must be a more straigt forward way.
I guess almost all custom variables that you set from the commandline will be used in a if statement.
Zims
optional command-line parameters
I have found the following to work:
It's shorter than previously suggested method... No need for additional $COMMANDLINE$ variable, as $CMDLINE$ is always pre-defined and available for if statements. And no need for the else clause because it is enough to have the single Set command for IA to be aware of the variable even if that line never executes (since the variable is initialized via command-line).
I am using IA 8... YMMV.
Code: Select all
if Variable CMDLINE not Contains (Ignore Case) MYPARAMETER=
Set Variable MYPARAMETER to ...
endI am using IA 8... YMMV.

