了解如何使用记事本(MS)进行反击

rsc*_*rin 3 powershell notepad backticks

如果我用powershell做的话

    [string]$text = "this `nis a `ntest"
    $text > c:\test.txt
Run Code Online (Sandbox Code Playgroud)

用notepad ++这就是结果:

    this
    is a
    test
Run Code Online (Sandbox Code Playgroud)

但如果我用Windows的记事本打开它它不起作用:

    this is a test
Run Code Online (Sandbox Code Playgroud)

为什么?我该怎么解决?

alr*_*roc 8

记事本专门使用Windows CRLF EOL标记.要在记事本中显示换行符,请使用以下命令:

`r`n
Run Code Online (Sandbox Code Playgroud)

合理的文本编辑器(读:几乎一切,但notepad.exe-我偏爱记事本+ +)处理所有EOL样式正确- CRLF,CRLF.