johnmcp
johnmcp

Reputation: 931

Setting environment variable with special characters through conda in powershell

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.

Upvotes: 1

Views: 917

Answers (1)

js2010
js2010

Reputation: 27546

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">

Upvotes: 0

Related Questions