powershell - 为什么我不能在 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 和同样的事情。
解决方案
Mathias R. Jessen 提供的答案:按 [Shift+Enter] 在 ISE 控制台中插入文字换行符
推荐阅读
- python - 将字典列表的 Python 数据框列转换为具有单个元素的列
- docker - Docker compose:[Errno 111] 连接被拒绝 - 多容器应用程序中的网络失败
- intellij-idea - 如何禁用
测试? - javascript - 无法让节点快速服务器运行
- java - 我们如何仅通过实现 Comparable 接口对 Objects 的元素进行排序?
- java - 模拟复杂的 Java 对象
- pytorch - 使用 Pytorch 张量创建简单的邻接矩阵
- c# - Screen.orientation 不会根据需要在 Unity 中将 UI 元素的位置从横向更改为纵向,但会在重新启动游戏时更改
- elasticsearch - ElasticSearch 6.8.13 多匹配查询不适用于空词
- c# - 将接口实现传递给方法并调用 AddTransient