

Variables are substituted when their value is required, and PATH is an example This is why alphabetical order has no importance. If you do set "a=x%b%y", then a is defined exactly like that, and %b% will (The second line to try giving time to the system to set the first var). Set /P WAITING_DUMMY=Enter value for WAITING_DUMMY Then, I replaced those with lines setx ZTEST_DIR C:\ztest This didn't give me vars ZTEST_DIR and YTEST_DIR in my environment. Then, I added lines set ZTEST_DIR=C:\ztest I verified that set_env_vars.bat is read. I am not sure if this would work for any application requiring the environment variables.Į.g., octave symbolic integration needing to find python somewhere in the PATH, with the directory in the PATH being added in this way.ĮDIT As per the answers by harrymc and myself, and following discussion, this is what I tried:Ĭreating a file set_env_vars.bat in an arbitrary directory, and set a shortcut to it in %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup.Īdding a line set /P PTEST=Enter value for PTEST in set_env_vars.bat to make sure the file is being read during logon. I thought about setting them in the desired order in a startup batch file ( autoexec.nt, or whatever is current). I can always use naming to ensure "nested" definitions follow alphabetical order. I mean to get a solution that functionally works the same as if the variables were defined via registry (or Control Panel). Is there any way of avoiding it? Working around it? Works, but this PYTHONDIR -> C:\Users\user1\myprogs This APYTHONDIR -> C:\Users\user1\myprogs Normally, if I define one User Windows 10 environment variable (var 1) in terms of another (var 2), var 2 should precede var 1 in alphabetical order for it to work.
