如果我使用 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。
关于powershell - 了解如何在记事本中使用反引号(MS),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17618329/