是否可以在字符串中写一个“,如果是,怎么办?

时间:2018-08-30 07:14:53

标签: string powershell escaping

我需要将"写入字符串,因为脚本需要格式,但是我不知道该怎么做。

是否需要将其标记为字符?

1 个答案:

答案 0 :(得分:3)

您需要将其加倍,将其放在单引号中,或使用`

对其进行转义
echo "This will output a double quote """
echo '"This will also be put in double quotes"'
echo "`"This is another way to quote`""

有关更多的字符串引用基础知识,请参见official documentation