Batch file to remove carriage return (New Line)

user1864359 picture user1864359 · Nov 29, 2012 · Viewed 8.1k times · Source

I need help to take the line breaks from my text file.

example data:

mango apple grapes peanut
mango apple grapes peanut
mango apple grapes peanut
mango apple grapes peanut

desired output:

mango apple grapes peanut mango apple grapes peanut mango apple grapes peanut mango apple grapes peanut

It will only work if it is on one line.

Answer

ElektroStudios picture ElektroStudios · Nov 29, 2012
@Echo OFF

:: By Elektro H@cker

FOR /F "Usebackq Tokens=*" %%@ IN ("File.txt") DO (
    <NUL Set /P "=%%@"
)

Pause&Exit