Setting environment variable with special characters through conda in powershell

Viewed 433

How do you set an environment variable through conda in powershell when the value has special characters? For example, if I run

conda env config vars set AZURE_CON_STRING="DefaultEndpointsProtocol=https;AccountName=anaccount;AccountKey=7mAi16vv4iyJtp8wPLxGf0ynaergfaergergeargaerg+pmWfKfTcoom/j6Ki7aviFS/f4RSyN3gergeru1aEiw==;EndpointSuffix=core.windows.net"

The resulting environment variable is just core.windows.net instead of the full string.

Using single quotes gives the same result. I have also tried enclosing with backtick (`) and @" "@ but to no avail.

1 Answers

Backslash.

conda env config vars set AZURE_CON_STRING=\"DefaultEndpointsProtocol=https;AccountName=anaccount;AccountKey=7mAi16vv4iyJtp8wPLxGf0ynaergfaergergeargaerg+pmWfKfTcoom/j6Ki7aviFS/f4RSyN3gergeru1aEiw==;EndpointSuffix=core.windows.net\"

Hmm not sure how to get there:

.\echoargs foo=\"foo bar\"

Arg 0 is <foo=\foo bar">
Related