Setup Command Line Variable - what is the default?

Got a problem you cannot solve? Try here.
Post Reply
MarkElder
Posts: 35
Joined: Mon Nov 07, 2005 5:41 pm

Setup Command Line Variable - what is the default?

Post by MarkElder »

Hello,

I am trying to add a feature to my setup that will allow users to bypass my pre-requisites by using a command line switch when running the setup.

I added this:
if Variable SkipNativeClient not Equals true
Include Script: checksqlncli9
end

I want my client to be able to run
setup.exe SkipNativeClient=true

If they just run setup.exe without any parameters I want the pre-requisite to install.

My questions is how do I set the default value for SkipNativeClient. If I try to compile this I get an error because SkipNativeClient is not defined.

If I add a set variable line will that be overwritten by the command line value? If that is true where does that happen - ever where the variable is set? Just the first time it is set?

The Pre-Defined variables indicate they are automatically initialized when the setup begins. Can I do that with my variables?

I see version 6.6 added a "Is Defined" option to the if statement. I'm not sure if that would solve my problem or not. I am using version 6.0 and am not ready to update yet.

Thanks,

Mark
MarkElder
Posts: 35
Joined: Mon Nov 07, 2005 5:41 pm

Post by MarkElder »

OK - I thought of some other keywords to search by and found this post:

http://www.installaware.com/forums/view ... ht=cmdline

Which suggests using:
Set Variable COMMANDLINE to $CMDLINE$
If COMMANDLINE contains (ignore case) MYPARAMETER=
Set MYPARAMETER=$MYPARAMETER$
Else
Set MYPARAMETER=
End

This seems to work and is what I am looking for. I'm still open to other suggestions if this is not the correct approach.

Thanks,

Mark
Alex_Ronquillo
Site Admin
Posts: 364
Joined: Mon Jul 30, 2007 11:51 am
Location: USA
Contact:

Post by Alex_Ronquillo »

This is another thing you can do. When running your installation file from the command line, you can include any number of parameters with their corresponding values. For example, let's say you have an installation file setup.exe, and you want to run it setting variables var1 and var2. Here is how you would do it:

setup.exe var1=true var2=false

Now, you can reference var1 and var2 in your setup.
Alejandro Ronquillo
InstallAware
Home of The Next Generation MSI Installer
Get your free copy today - http://www.installaware.com/
MarkElder
Posts: 35
Joined: Mon Nov 07, 2005 5:41 pm

Post by MarkElder »

Sure, but that does not answer my question. In my setup what is the value of var1 if it was not included on the command line. Where is that default set and how do I control what the default value is?
SteveDude
Posts: 253
Joined: Wed Apr 11, 2007 6:07 pm

Default Value

Post by SteveDude »

The default is $CMDLINE$ which contains everything entered.

It's up to you on how you want to handle the content.

Parse whatever you want out of it.

Could just do If $CMDLINE$ = SkipNativeClient(Ignore Case) then skip it.
Post Reply