question

rainmakers-3202 avatar image
0 Votes"
rainmakers-3202 asked

Not able to nest System Environment Variables

In Windows Server 2019 I'm trying to set as a system variable with another variable within it, and it is not expanding.

To duplicate issue
[System.Environment]::SetEnvironmentVariable('COOKIE_VALUE','myCookies' , 'MACHINE')
[System.Environment]::SetEnvironmentVariable('RABBITMQ_SERVER_ERL_ARGS','-setcookie %COOKIE_VALUE%' , 'MACHINE')

Then reboot.
Open dos prompt and type

echo %RABBITMQ_SERVER_ERL_ARGS%

On Windows 2019 the response is: -setcookie %COOKIE_VALUE%
But in Windows 2012R2 the response is: -setcookie myCookies

Is there a way to change the behavior of how Windows 2019 handles nested variables?
Thanks in advance.


windows-server
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

0 Answers