rows to 1column?

H

Henry

Ladies and Gentlemen
Can you possibly assist?
I have a file Current_file.txt. I need to use the rows in
this file as ONE single string. Making use of .bat how can
I convert the rows to colums?

Example:
more Current_file.txt
one
two
three

more New_file.txt
one two three
 
M

Matthias Tacke

Henry said:
Ladies and Gentlemen
Can you possibly assist?
I have a file Current_file.txt. I need to use the rows in
this file as ONE single string. Making use of .bat how can
I convert the rows to colums?

Example:
more Current_file.txt
one
two
three

more New_file.txt
one two three

@echo off
setlocal

echo Version one
for /F "tokens=*" %%A in (current_file.txt) do (set /P =%%A <nul)
echo ^<-

echo Version two
if defined line set line=
for /F "tokens=*" %%A in (current_file.txt) do (call set line=%%line%% %%A)
echo %line:~1%^<-

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top