marcp
10th February 2006 09:29 UTC
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"
kichik
10th February 2006 10:34 UTC
You can use ExpandEnvStrings or ReadEnvStr to read environment variables.
Takhir
10th February 2006 10:47 UTC
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.
kichik
10th February 2006 10:49 UTC
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
marcp
10th February 2006 13:15 UTC
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!
sixcode
19th May 2006 10:39 UTC
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