如何从批处理文件输出中插入换行符?
我想做的事情是:
echo hello\nworld
这将输出:
hello
world
如何从批处理文件输出中插入换行符?
我想做的事情是:
echo hello\nworld
这将输出:
hello
world
当前回答
如果有人来这里是因为他们想从MINGW make makefile中回显一个空行,我使用
@cmd /c echo。
简单地使用echo。导致可怕的process_begin: CreateProcess(NULL, echo。,…)失败了。错误消息。
我希望这能帮助到至少一个人:)
其他回答
如果有人来这里是因为他们想从MINGW make makefile中回显一个空行,我使用
@cmd /c echo。
简单地使用echo。导致可怕的process_begin: CreateProcess(NULL, echo。,…)失败了。错误消息。
我希望这能帮助到至少一个人:)
Use:
echo hello
echo:
echo world
要回显换行符,请添加一个点。就在回声之后:
echo.
Ken和Jeb的解决方案效果很好。
但是新行只生成一个LF字符,我需要CRLF字符(Windows版本)。
为此,在脚本的末尾,我已经将LF转换为CRLF。
例子:
TYPE file.txt | FIND "" /V > file_win.txt
del file.txt
rename file_win.txt file.txt
Echo hello & Echo .world
这意味着您可以定义& echo。作为换行符的常数\n。