如果我使用PowerShell执行以下操作
[string]$text = "this `nis a `ntest"
$text > c:\test.txt
使用notepad++,这是结果:
this
is a
test
但是如果我使用Windows的记事本打开它,它就无法工作:
this is a test
为什么会这样?我该如何解决?
如果我使用PowerShell执行以下操作
[string]$text = "this `nis a `ntest"
$text > c:\test.txt
使用notepad++,这是结果:
this
is a
test
但是如果我使用Windows的记事本打开它,它就无法工作:
this is a test
记事本仅使用 Windows CRLF EOL
标记。要在记事本中显示换行符,请使用以下方法:
`r`n
合理的文本编辑器(即几乎所有编辑器,但notepad.exe
除外——我偏爱Notepad++)可以正确处理所有EOL风格,包括CRLF、CR和LF。