Windows batch: echo without new line

后端 未结 18 1406
失恋的感觉
失恋的感觉 2020-11-22 04:01

What is the Windows batch equivalent of the Linux shell command echo -n which suppresses the newline at the end of the output?

The idea is to write on t

18条回答
  •  旧巷少年郎
    2020-11-22 04:54

    You can remove the newline using "tr" from gnuwin32 (coreutils package)

    @echo off
    set L=First line
    echo %L% | tr -d "\r\n"
    echo Second line
    pause
    

    By the way, if you are doing lots of scripting, gnuwin32 is a goldmine.

提交回复
热议问题