Getting environment variable using Inno setup

2019-09-20 16:06发布

问题:

I have an update version of a file that I need to provide to the user,

I have given the user the choice to install the original software wherever they want,

So now to do the update I need the PATH system variable to know where they installed the software,

I have the following code:

[Setup]
#define path GetEnv('TEMPFILE')
DefaultGroupName={#path}

[Files]
Source: "E:\folder \license.exe"; DestDir: "{app}\temp\installation_files\"; Flags: ignoreversion

But the code gives me an error during installation!

Does someone know why?

Maybe i can do this differently,

Can someone explain to me hoe this function works:

function GetEnv(const EnvVar: String): String;

回答1:

The solution that worked for me can be found in the following link:

Retrieve environment variable using RegQueryStringValue in Inno Setup



标签: inno-setup