Hello,
in my setup an new environment variable for PATH is created. After Apply install I am executing an .exe file that needs this new PATH env. variable.
How can I achive it that the .exe can 'see' this new variable?
I am looking for something like this batch command:
setlocal
path=C:\Program Files\Pervasive Software\PSQL\bin\;%path%
Any idea?
Use a new environment variable immediately in setup
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Use a new environment variable immediately in setup
Dear Alibaba,
maybe I'm missing something, but why don't you use "GetEnvironmentVariable" WIN API from your EXE?
Regards
maybe I'm missing something, but why don't you use "GetEnvironmentVariable" WIN API from your EXE?
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Use a new environment variable immediately in setup
The problem is that this environment variable is created in the same 'process', so this variable is not visible to the function.
only in a new process the newly created env. variable is visible.
For example, if I start the IA setup from a batch: The setup creates the env variable and afterwards in the batch an .exe is called that reads this env. variable. The .exe is not able to read this variable. Only if I run the command: "setlocal path=C:\Program Files\Pervasive Software\PSQL\bin\;%path%" between IA setup and .exe, the .exe is able to access the env. variable.
only in a new process the newly created env. variable is visible.
For example, if I start the IA setup from a batch: The setup creates the env variable and afterwards in the batch an .exe is called that reads this env. variable. The .exe is not able to read this variable. Only if I run the command: "setlocal path=C:\Program Files\Pervasive Software\PSQL\bin\;%path%" between IA setup and .exe, the .exe is able to access the env. variable.
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Use a new environment variable immediately in setup
Dear Alibaba,
sorry, but I still believe to miss something.
If the environment variable is created by the setup and then once terminated you launch the EXE, these will run under two different processes.
isn't it?
Regards
sorry, but I still believe to miss something.
If the environment variable is created by the setup and then once terminated you launch the EXE, these will run under two different processes.
isn't it?
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Re: Use a new environment variable immediately in setup
no, if I start the setup and then the .exe both from one batch file, then they are running in the same process. At least the environment variable created in the setup is not visibe to the .exe.
But I don't want to use a batch, this was just for illustration. I want to call the .exe in the IA setup at the end. But there is the same problem, the newly created environment variable is not visible to the .exe at the end of the setup. How can I achive that the environment variable can be used by the .exe.
I also tried run program as and entered the Environment in the dialog but this didn't work...
But I don't want to use a batch, this was just for illustration. I want to call the .exe in the IA setup at the end. But there is the same problem, the newly created environment variable is not visible to the .exe at the end of the setup. How can I achive that the environment variable can be used by the .exe.
I also tried run program as and entered the Environment in the dialog but this didn't work...
-
- Site Admin
- Posts: 5361
- Joined: Sun Aug 22, 2010 4:28 am
Re: Use a new environment variable immediately in setup
Dear Alibaba,
... doing a Google search I found the folowing discussion ... If you haven't already, I suggest you to have a look.
http://stackoverflow.com/questions/3636055/how-to-modify-the-path-variable-definitely-through-the-command-line-in-windows
Hope this helps you.
Regards
... doing a Google search I found the folowing discussion ... If you haven't already, I suggest you to have a look.
http://stackoverflow.com/questions/3636055/how-to-modify-the-path-variable-definitely-through-the-command-line-in-windows
Hope this helps you.
Regards
Francesco Toscano
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
InstallAware Software
White Papers (HowTos) - http://www.installaware.com/publication ... papers.htm
Publications - http://www.installaware.com/publications-review.htm
InstallAware Help -F1 anywhere in the InstallAware IDE
Who is online
Users browsing this forum: Google [Bot] and 14 guests