开发者

How can I save strings as raw data in Powershell?

开发者 https://www.devze.com 2023-03-16 07:56 出处:网络
I would like to set a string with special chars in it ($ for example). How can I save a string as a raw string?

I would like to set a string with special chars in it ($ for example). How can I save a string as a raw string?

$B = "A$$B" isnt saved 开发者_开发技巧as "A$$B".

Thanks.


If the string is in ' (single quotes) the variables ( like $x ) are not expanded.

Also, Powershell has here-strings much like verbatim strings in C#

http://blogs.msdn.com/b/powershell/archive/2006/07/15/variable-expansion-in-strings-and-herestrings.aspx


maybe you can use the ` to escape chars (called 'backqoute')


Use single quotes to set literal values in Powershell:

$B = 'A$$B'
0

精彩评论

暂无评论...
验证码 换一张
取 消