Here is the code/output all in one:
PS C:\code\misc> cat .\test.ps1; echo ----; .\test.ps1
$user="arun"
$password="1234*"
$jsonStr = @"
{
"proxy": "http://$user:$password@org.proxy.com:80",
"https-proxy": "http://$user:$password@org.proxy.com:80"
}
"@
del out.txt
echo $jsonStr >> out.txt
cat out.txt
----
{
"proxy": "http://1234*@org.proxy.com:80",
"https-proxy": "http://1234*@org.proxy.com:80"
}
Content of string variable $user
is not substituted in $jsonStr
.
What is the correct way to substitute it?