Search code examples
environment-variablesnsis

How can I define values from outside my script?


I'd like to pass some variables into my .nsi script. Either from the environment or the command line, how do I do this?

I found a section in the documentation that suggests I can use the syntax $%envVarName% to use environment variables in my script, but this doesn't seem to work, when I have

File "/oname=$pluginsdir\inst.msi" "$%VERSION%-Installer-64bit.msi"

I get the error

File: "$%VERSION%-Installer-64bit.msi" -> no files found.

$VERSION is in my environment.

Is there something I'm doing wrong with trying to read environment variables, or some other way of passing values into my script?


Solution

  • $%VERSION% should work if you used set VERSION=1.2.3.4

    Or you can create defines: makensis -DVERSION=1.2.3.4 myscript.nsi and File: "${VERSION}-Installer-64bit.msi"