Reputation: 1
I have this PowerShell string:
"/qP9O7BayvZAoAqg5sTHzmHAQ3Ghv1E+mFkoYDa6tG8keQU2pzPYvpVE6i3MIT7e+k0QQafHpvFMFz2um7xTMQ=="
which I have escaped as follows:
"\/qP9O7BayvZAoAqg5sTHzmHAQ3Ghv1E\+mFkoYDa6tG8keQU2pzPYvpVE6i3MIT7e\+k0QQafHpvFMFz2um7xTMQ=="
But the string is not being acccepted. It's ok when pasted in "
. Not sure what I am missing?
Upvotes: 0
Views: 3841
Reputation: 13567
Strings in PowerShell always must be surrounded in either single or double quotes. The difference between the two is whether or not you want to substitute variables.
Imagine this:
$name = 'Stephen'
Write-output "Hello $name"
Write-Output 'Hello $name'
The output of this would be the following:
Hello Stephen
Hello $name
Use double quotes when you want to substitute or expand variables, and use single-quotes when you want to present text exactly as you list it.
Upvotes: 1