Archive: How to pass a new variable values to scripts by cmdline ?


How to pass a new variable values to scripts by cmdline ?
Assume I have a succesful working script with a fixed definition like

!define VERSION "V.3.3"
Name "BlaBla ${VERSION}"

Now I want to prepare a new installer exe for version 3.4 by compiling the same old script FROM COMMAND LINE !! but with a new VERSION assignment. The used/included files are all the same. I am thinking about a technique like:

makensis myscript VERSION="V.3.4"

but this doesn't work. How do I assign new values to
script variables without coding them explicitely inside the script?

Thx
Thomas


Look here and you will find out that you actually have to use the /D switch:

makensismyscript/DVERSION="V.3.4"

But then you need to remove the '!define VERSION "V.3.3"' line from the script and compile the V.3.3 script with:
makensismyscript/DVERSION="V.3.3"

An example is here, under the header 'How can I make my script depend on some registry value/the version of my product/<something dynamic>?'.

Chapter 2 of the docs:

Using the /D switch one or more times will add to symbols to the globally defined list.

Makensis [/Ddefine[=value] ...]


Joost, you where just a minute too late: I just told him this. :) ;)


Hmm, from time to time I want to compile the script by using the GUI.

Ok you said I have to remove the !define VERSION statement in order to be able to compile the nsi script from cmdline.

When I switch later back to the GUI version to compile it from inside the GUI I have to enter the !define statement again.
This is very inconvenient.

It would be better if NSIS would accept command line parameters assginments as assignments with higher priority

Is there maybe another solution ?

Thx
Thomas


Then instead of removing the define do this:-
!ifndef VERSION
!define VERSION "V.3.3"
!endif