Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can one use environment variables in Inno Setup scripts?

I need to find a way to reference environment variables INSIDE the Inno Setup script file (.iss)...

I've found plenty of references to MODIFYING the environment from an .iss, but none on how to actually use it. Is this possible?

like image 508
dicroce Avatar asked Jan 04 '10 21:01

dicroce


People also ask

How do you set an environment variable in a script?

The easiest way to set environment variables in Bash is to use the “export” keyword followed by the variable name, an equal sign and the value to be assigned to the environment variable.

Can environment variables change during execution?

No. This is not possible. One process can never directly manipulate the environment of a different already-running process.

Which file is required to set the environment variable?

env files are a great solution. It's a file inside your project in which you specify these environment variables and afterwards you use a library for your respective programming language to load the file which will dynamically define these variables.


2 Answers

I ran into the same problem when trying to specify the source location of files in the [Files] section. I used the GetEnv function to define a new constant.

#define Qt5 GetEnv('QT5') [Files] Source: {#Qt5}\bin\Qt5Concurrent.dll; DestDir: {app};  
like image 193
goran Avatar answered Sep 22 '22 05:09

goran


According to this page in the Inno Setup documentation, the value of environment variables can be retrieved using the following syntax:

{%name|default} 
like image 39
Nathan Osman Avatar answered Sep 22 '22 05:09

Nathan Osman