'Can one Windows environment variable refer to another windows environment variable?
I want to support two versions of a Windows app easily. It uses environment variables to configure it.
I'd like to set up a top level ENV, that can be changed to switch versions:
VERSION_ROOT = c:\tool_version_A
TOOL_BIN_FOLDER = $VERSION_ROOT\bin
TOOL_LIB_FOLDER = $VERSION_ROOT\lib
Then if I need to switch to tool version B, I just change the VERSION_ROOT
environment variable: VERSION_ROOT = c:\tool_version_B
and I'm done.
Any way to make this work in Windows?
Solution 1:[1]
Durn it! No - When I put %TOOL_BIN_FOLDER% in the Windows 10 environment variable edit box it IMMEDIATELY expands it to the folder location, replacing the variable with the hard wired path #facepalm.
This didn't work: Trying to use the Windows batch file variable synth with the surrounding % signs:
TOOL_BIN_FOLDER = %VERSION_ROOT%\bin
More hints here: Limits on Windows environment variable nesting?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Gord Wait |