Environment Variable on Command Line - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

virgil
Posts: 22
Joined: Sat Mar 19, 2011 1:40 am

Environment Variable on Command Line

I've noticed that when using the %USERPROFILE% Environment Variable as a property of a command line switch, it's being expanded automatically. I noticed this does not happen with other Environment Variables such as %APPDATA%;

Code: Select all

"C:\MyInstaller.exe" MY_VAR="%USERPROFILE%\MyApp"
^ Gets expanded to MY_VAR="C:\Users\<username>\MyApp"

Code: Select all

"C:\MyInstaller.exe" MY_VAR="%APPDATA%\MyApp"
^ Does not get expanded; remains as MY_VAR="%APPDATA%\MyApp"

I would like the %USERPROFILE% in a command line to remain unexpanded, is this possible ?
Last edited by virgil on Fri Jul 13, 2012 11:05 pm, edited 1 time in total.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Environment Variable on Command Line

Hello,

I noticed in your example your mentioned APPDIR. Please keep in mind that is not an environment variable, otherwise can you give us more details on the steps leading to this behavior?

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
virgil
Posts: 22
Joined: Sat Mar 19, 2011 1:40 am

Re: Environment Variable on Command Line

Sorry, I meant APPDATA. I've edited the post. Issue still stands, only USERPROFILE is expanded, not other env. vars.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Environment Variable on Command Line

Hello,

This is part of the common built-in environment variables behavior in Windows operating system. Some environment variables are designed to expand, others don't.

You can search the Internet for more related information. Here's a good place to start.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”