3 ms·
To escape $ you either need to use a single quoted string so the $ is treated literally or in a double quoted string use a backtick before the $ to escape it
by jborean93 2y ago
To escape $ you either need to use a single quoted string so the $ is treated literally or in a double quoted string use a backtick before the $ to escape it
Write-Host 'Foo$Bar'
Write-Host "Foo`$Bar"
- RajT88 2y agoA lot of people's complaints in this thread are because they just haven't figured out the powershell way of doing that thing. Granted - the Powershell way of doing some things is stupidly obtuse sometimes.
- felsokning 2y agoIn the issue I ran into, the '$' comes back from Azure in the nextLink[1] value. As soon as you try to process the string, the reserved token '$' breaks any processing - precisely because it wasn't escaped before being stored. Perhaps, it's easy enough to do some .NET manipulation, just to get PowerShell to be able to handle the string for the next Invoke-RestMethod -- but its far easier to just curl those urls, instead. [1] - https://learn.microsoft.com/en-us/rest/api/keyvault/keyvault/vaults/list?view=rest-keyvault-keyvault-2022-07-01&tabs=HTTP#examples https://learn.microsoft.com/en-us/rest/api/keyvault/keyvault...