【发布时间】:2014-05-08 05:52:10
【问题描述】:
假设我有一个文本文件,其中第一行是返回,第二行是单词“second”
我运行 cmdlet:
PS > $([System.IO.File]::ReadAllText("C:\Tmp\Foo.txt"))[2] -eq 's'
结果为真,第三个字符是's',所以前两个字符代表换行
但是当我跑步时
PS > $([System.IO.File]::ReadAllText("C:\Tmp\Foo.txt"))[1] -eq '`n'
或
PS > $([System.IO.File]::ReadAllText("C:\Tmp\Foo.txt"))[1] -eq '`r'
全部返回 False
如何在 PowerShell 中匹配换行符?
【问题讨论】:
标签: powershell newline