当我在PowerShell控制台中输入这个时
$test=@'
Test
Test'@
输入多次后,它会持续打印输出。
>>
所以我永远无法完成命令。
该怎么办?
当我在PowerShell控制台中输入这个时
$test=@'
Test
Test'@
输入多次后,它会持续打印输出。
>>
所以我永远无法完成命令。
该怎么办?
'@
应该放在行的开头,否则它将被视为字符串的一部分。
$test=@'
Test
Test
'@
这种方法也适用于@"
/"@
$test=@'
Test
Test
'@
需要注意的重要事情是分隔符包括(不可见的)回车符。在起始标签结束时必须有一个回车符,在结束标签之前也必须有一个。
$myStr = ("The family of Dashwood had long been settled in Sussex. Their estate was " +
"large, and their residence was at Norland Park, in the centre of their " +
"property, where, for many generations, they had lived in so respectable " +
"a manner as to engage the general good opinion of their surrounding " +
"acquaintance.")
"@
(或'@
)需要位于最后一行的开头,之后不能有任何内容。 - CJBS'@
或"@
之前没有任何内容。在“here string”终止符之后可能有命令或注释。 - CJBS