Summary:
The program I am working on is not a traditional use of the installer and would really be a standard executable but Inno Setup is the only tool I have and I have made it fit all kinds of purposes so far.
Current trial - is to delete specific files, located by using an environment variable (PROG_USER
). This part is fine initially, the application works fine if the variables are set in Windows. I have it validate first the variable is set. If so, it allows the user to continue.
The issue:
But here is the issue. I run many test environments each sets variables from the running application, typically any program I launch from this program inherits these variables. But so far Inno Setup always tries to resolve the registry. Is there any way to collect the current session variables?
A simple test would be to execute the program from either a batch or a command prompt after setting the variable e.g. SET PROG_USER=c:\testing\version2\user_files
Then launch the executable, each time it lets me know the variable is not set even though if I run SET
I can see this session does have that value. Like I said maybe this is a stretch too far but I have seen some great answers and I am hoping to find one for this.
Update:
I want to use variables but not the one in the registry.
e.g. PROG_USER=USER1
(in registry)
But the application I will launch the installer from has set PROG_USER=USER20
My code is like this:
procedure InitializeWizard;
var
MsgResult: Integer;
PROG: string;
begin
PROG := GetEnv('PROG_USER');
if PROG <> '' then
begin
MsgResult :=
MsgBox('PROG_USER Path = ' + PROG + #13#10 +'Do you wish to still proceed?',
mbInformation, MB_YESNO);
if MsgResult = IDYES then
begin
{ user pressed Yes do rest of program }
end
else
if MsgResult = IDNO then
begin
Abort;
end
end
else
begin
MsgBox('PROG_USER variable is not set, this process will now exit!',
mbInformation, MB_OK);
Abort;
end;
end;
This code is fine if you want to check and or use the environment variables as set globally by Windows (as you know Windows stores these in the registry which it seems is where Inno Setup looks?)
I want the current variables used by another application. I am launching my "setup" from another program not by double clicking it.
As I mentioned this can be simulated by a simple batch file that calls the setup.exe
. Typically any program called this way will inherit the variables set in that batch (or program) but my Inno Setup does not.