有没有办法在powershell中转义字符串,如@“string"?在 C# 中 [英] is there a way to escape a string in powershell like @"string" in C#

查看:37
本文介绍了有没有办法在powershell中转义字符串,如@“string"?在 C# 中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法像@"string"在C#中工作一样转义一个完整的字符串?我正在编写一个脚本,在那里我有几个看起来像这样的字符串:D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)

Is there a way to escape a complete string i powershell the same way the @"string" Works in C# I am writing a script and in there I have several strings that looks like this: D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)

一个人逃离 回家的路还很长

escaping one by one There's is a long way home

推荐答案

要在 Powershell 中逐字引用字符串,只需使用单引号:

To quote verbatim strings in Powershell, just use single quotes:

'D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)'

Get-Help about_Quoting_Rules

这里

这篇关于有没有办法在powershell中转义字符串,如@“string"?在 C# 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆