ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Path variables

So from reading other posts it seems the path enviornment variables arent edited till after the install finishes. Which I find weird since it was working on other machines that I know didnt have the files it needed before hand. Also I notice that the enviornment is set.

However, while the installer is running my cmd file it doesnt know about the variable. But if I stop it. Open a new window it does know about the path.

So the question is is there another way around creating another MSI just for a path variable.

Can I like run another file that sets the path in a previous cmd window. Or is this a new glitch since I haven't had this issue until I updated to the new advanced installer?
ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Re: Path variables

Well trying set the path from an environment variable I would still run into the issue if the user decided to change where it was installed to. So I can't do that.

I really don't want to have to force a reboot or create an entirely new MSI just to create path enviornment variable. I did relook at the posts and they are quiet dated. So Im hoping theres been a change to how this can be done. As I would figure its something super common that happens.
ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Re: Path variables

So something I attempted to do to work around this didnt work. I decided to add to my batch file an arguement to set the path for that run through.

Im adding set to set the path in the installer and passing in my path. However advacned installer is only passing in till the space.
If i try to pass the path in using quotes it wont even run the batch file.

Code: Select all

Part of the batch file I care about echo %~1% 

set PATH=%PATH%%~1;


pause
I also attempted it with %1%.

Arguement being passed in.

"[APPDIR]services\nssm\win32"

Both ways work just fine when running on my own computer. How do I resolve this issue. Also If theres an easier solution Id love to hear it.
ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Re: Path variables

Working on an alternate method if there is no way pre-install completion to use the environment variables.

I found this https://www.advancedinstaller.com/user- ... ation.html

Though I had some questions about it. Of course I'd like my prior questions answered as well as pre-completion is ideal.

It states to move the custom action under AddResources. For clarity you mean it runs after this method correct?

Also it states. Set the "Condition" field in the "Execution Stage Condition" section to (Not Installed)

However the only check boxes are install,uninstall,maintenance,first time install, regular uninstall, upgarde, replaced by version or a text condition box and advanced execution stage though it generally only includes is being installed, patched, minor upgrade, and being unistalled. None which state anything I see to the effect of being after install.
ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Re: Path variables

NVM
ruck64
Posts: 57
Joined: Wed Jul 24, 2019 8:46 pm

Re: Path variables

For anyone else with this issue. I made sure it was handled after i added my resources. Then add the paths through the command line surrounded by quotes.
[APPDIR] actual adds on a slash to the end of it. so its like myapp\
So watch out for that.
I passed them into my batch file using %~1% Where 1 is the argument number.
Thus I didnt have to perform a reboot and handled the environment variables not being available to command prompt that was opened up.

Hopefully this helps someone else
Catalin
Posts: 6594
Joined: Wed Jun 13, 2018 7:49 am

Re: Path variables

Hello,

Thank you for your followup on this and for sharing your solution with us.

I'm sure this will be of help for further users facing a similar scenario.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”