小编yan*_*taq的帖子

Powershell在这里 - 字符串扩展

这里串

有一些关于Powershell'here-string'的例子,但我很难遇到'here-string'扩展.所以我发布这个有一些帮助.

当你想添加一些带换行符的文字时,单引号和双引号都不需要转义,也不需要换行符"`r`n".'here-strings'在PowerShell中得到了拯救.他们应该从一开始

@"
和换行符应以换行结束
"@

For example:                        |Result:
                                    |
@"                                  |
Hello world! 09/25/2014 11:39:56    |      Hello world! 09/25/2014 11:39:56
'(this will appear as is)'          |      '(this will appear as is)'
!                                   |      !
"@                                  |
Run Code Online (Sandbox Code Playgroud)

powershell powershell-3.0

10
推荐指数
1
解决办法
2万
查看次数

有没有办法知道 Powershell 中的 cmdlet 版本以实现向后兼容性?

假设您正在 Powershell 4.0 环境中编写脚本,并且希望确保该脚本可以在 Powershell 3.0 中运行。如何确保其向后兼容?

powershell powershell-2.0 powershell-3.0

5
推荐指数
2
解决办法
4389
查看次数