Innosetup + Environment variables

935 views
Skip to first unread message

Thomas Schweikle

unread,
Mar 5, 2021, 1:05:32 PM3/5/21
to innosetup
Hi!

Having a setup where OutputDir (within [Setup]) is set with:
OutputDir={%USERPROFILE}\src\{#MyAppName}

Now compiling this I'd expected to have '{%USERPROFILE}' expanded to my userprofile: 'C:\Users\<username>'. But: it does not. It is just taken as is, what leads to InnoSetup creating a directory named '{%USERPROFILE}\src\<applicationname>}'.

Is it intended not to expand this as described within the handbook (https://jrsoftware.org/ishelp/index.php?topic=consts)?

Martijn Laan

unread,
Mar 5, 2021, 1:16:25 PM3/5/21
to inno...@googlegroups.com
Hi,

> Op 5 mrt. 2021 om 19:05 heeft Thomas Schweikle <tschw...@gmail.com> het volgende geschreven:
>
> Is it intended not to expand this as described within the handbook (https://jrsoftware.org/ishelp/index.php?topic=consts)?

As this topic it's Setup and Uninstall who expand. So not the compiler as you're expecting. Use ISPP for such functionality at compile time.

Greetings,
Martijn

Thomas Schweikle

unread,
Mar 5, 2021, 1:25:23 PM3/5/21
to innosetup
On Friday, March 5, 2021 at 7:16:25 PM UTC+1 Martijn Laan wrote:
Hi,

> Op 5 mrt. 2021 om 19:05 heeft Thomas Schweikle  het volgende geschreven:
>
> Is it intended not to expand this as described within the handbook (https://jrsoftware.org/ishelp/index.php?topic=consts)?

As this topic it's Setup and Uninstall who expand. So not the compiler as you're expecting. Use ISPP for such functionality at compile time.

This means '{%...}' is expanded at install time? And I have to use InnoSetup PreProcessor to expand it at compile time? Hmmmm. How do I have to write it to make ISPP to expand it instead being expanded at install time -- since I use this value at creating the installer, not while installing!
Any hint where to find these information. Could not find them by searching documentation.

Martijn Laan

unread,
Mar 5, 2021, 1:39:45 PM3/5/21
to inno...@googlegroups.com
Op 5-3-2021 om 19:25 schreef Thomas Schweikle:
Any hint where to find these information. Could not find them by searching documentation.

See https://jrsoftware.org/ispphelp/index.php?topic=getenv

So: OutputDir={#GetEnv('USERPROFILE')}\src\{#MyAppName}

Greetings,
Martijn Laan

Thomas Schweikle

unread,
Mar 5, 2021, 6:54:38 PM3/5/21
to inno...@googlegroups.com
This worked! Thanks. 

--
Thomas
Reply all
Reply to author
Forward
0 new messages