首页 > 解决方案 > 为什么我不能在 Powershell ISE 中创建 here-string?

问题描述

试图创建一个here-string

> $scriptblock =@'
The string is missing the terminator: '@.
 + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
 + FullyQualifiedErrorId : TerminatorExpectedAtEndOfString

为什么我在 Powershell ISE 中得到这个,但它在 Powershell 中正常工作?5.1 版。

> $scriptblock =@'
>> 

不,单引号后没有空格。我只是按Enter。我什至关闭并重新打开了 ISE 和同样的事情。

标签: powershellherestring

解决方案


Mathias R. Jessen 提供的答案:按 [Shift+Enter] 在 ISE 控制台中插入文字换行符


推荐阅读