Archive: File and environment variable?


File and environment variable?
Is it possible to include a file and base it's location on an environment variable?

I would like to make the script more general and set a script variable, based on value of an environment variable, in the .inInit Then use the variable to tell where file can be found that needs to be packed.


Var NSIS_FILELOCATION

File "$NSIS_FILELOCATION\program.jar"

You can use ExpandEnvStrings or ReadEnvStr to read environment variables.


marcp probably wrote about compile-time file location, this may be done using !system and !include. I saw samples for compile time version updates, forum search can help to find threads.


If that really is the case, you can use the $%var% syntax. There's no need for !include and !system. Simply use:

File $%SOME_ENV_VAR%\program.jar

Thanks for your support. :up:

Indeed compile time file location.

Using the $ folowed by the windows environment variable name between %-signs as you do in normal batch files works perfectly :)

Perfect again something learned!


Originally posted by kichik
If that really is the case, you can use the $%var% syntax. There's no need for !include and !system. Simply use:
File $%SOME_ENV_VAR%\program.jar
This is exactly what i needed

big thanks :D