Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
alleypuppy
- Posts: 82
- Joined: 24 Apr 2011 19:20
#1
Post
by alleypuppy » 08 Dec 2011 12:27
Hello,
I have a text file that is appended to by a batch file. I want to echo the data of the file on one line using a FOR /F loop and set the result equal to a variable. I'm guessing this is possible, but I don't know how to do it. For example, here is my text file:
I want the result to look like this:
Keep in mind that this file is constantly being added to.
Thanks for any help!
-
!k
- Expert
- Posts: 378
- Joined: 17 Oct 2009 08:30
- Location: Russia
#2
Post
by !k » 08 Dec 2011 12:53
Code: Select all
setlocal enabledelayedexpansion
set "$="
for /f "usebackq delims=" %%a in ("text.txt") do set "$=!$!%%a"
echo:!$!
-
alleypuppy
- Posts: 82
- Joined: 24 Apr 2011 19:20
#3
Post
by alleypuppy » 08 Dec 2011 14:57
!k wrote:Code: Select all
setlocal enabledelayedexpansion
set "$="
for /f "usebackq delims=" %%a in ("text.txt") do set "$=!$!%%a"
echo:!$!
Works perfectly, thanks!