alexiaamber
Posts: 1
Joined: Mon Aug 04, 2025 9:49 am

How to set a default installation path based on user environment variable?

Hi everyone,

I'm currently working on an installer using Advanced Installer (Professional edition), and I’d like to set the default installation path based on a custom environment variable defined on the user's system (e.g., %MY_CUSTOM_DIR%).

I tried using the APPDIR property with a formatted path like [MY_CUSTOM_DIR]\MyApp, but it seems the variable isn't being resolved properly during the install.

Has anyone dealt with a similar setup? What’s the correct way to reference environment variables in the installation path, or is there a recommended workaround?

Thanks in advance for your help!
Catalin
Posts: 7504
Joined: Wed Jun 13, 2018 7:49 am

Re: How to set a default installation path based on user environment variable?

Hello and welcome to our forums,

First of all, please accept my apologies for the delayed reply - it's holiday season and we are a bit behind on schedule on support due to colleagues being away.

To achieve what you need, you can use a PowerShell script that retrieves the value of your environment variable and then set APPDIR using that same PowerShell script, using AI_SetMsiProperty cmdlet.

Please let me know if you require any further assistance.

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

Return to “Common Problems”