windowsbatch-filecmdnewline

Windows batch: echo without new line


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 the same line inside a loop.


Solution

  • Using set and the /p parameter you can echo without newline:

    C:\> echo Hello World
    Hello World
    
    C:\> echo|set /p="Hello World"
    Hello World
    C:\>
    

    Source