Accessing Path Variables from BAT script - Advanced Installer Community
mmrd
Posts: 2
Joined: Mon Jan 25, 2016 3:21 pm

Accessing Path Variables from BAT script

Hello.

I'm trying to access the User and System PATH environment variables during installation.

As a rough test, I have AI calling a .BAT with the command SET > paths.txt. If I run this .BAT manually, I see both the system and user environment variables.

If i call the same .BAT from Advanced Installer, I seem to only get the System environment variables. How can I get both? In other words, how can I mimic what happens when I run manually.

Any help is appreciated.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Accessing Path Variables from BAT script

Hello and welcome to our forums,

First of all I apologize for my delayed reply. We were out of the office in the past days.

I'm afraid I don't fully understand what you mean. Can you please give us more details about this (maybe exemplify a bit)?

Have you launched your BAT file using a "Launch file" custom action?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mmrd
Posts: 2
Joined: Mon Jan 25, 2016 3:21 pm

Re: Accessing Path Variables from BAT script

Hello David.

Yes. We are launching our BAT file through the Custom File action.

As an example:

When you look at your windows environment variables (System Properties -> Environment Variables) there two sets of variables "User" and "System" (See environment.png attached).

If I run the batch command through the commandline:

Code: Select all

SET > paths.txt
it prints a file called Paths.txt. Looking at that file I see both the system and user environment variables are being printed.

If put that same command in a .bat file and run from Advanced Installer (using Launch File), I only get the System environment variables.

How can I get both? In other words, how can I get the same output for what happens when I run

Code: Select all

set
manually through the command line.
Attachments
environment.PNG
environment.PNG (14.56 KiB) Viewed 2843 times
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Accessing Path Variables from BAT script

Hello,

I'm not sure why this happens. I tested the scenario, but I cannot replicate the issue. Please find attached a sample which implements your scenario and let us know if this helped.

All the best,
Daniel
Attachments
sample.zip
(2.81 KiB) Downloaded 202 times
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”