Christian4561
Christian4561

Reputation: 72

Read a file in batch

I am creating a small batch application and I would like to know how to to put file contents into variables or wildcards. (Don't know which one it is) I used to be able to do "set blablabla=< MainChat.txt" but it is not working. It would be very helpful if someone could tell me how to load one line of a file into a variable, and the next line into another.

Upvotes: 0

Views: 73

Answers (1)

npocmaka
npocmaka

Reputation: 57252

read file line by line including empty lines -> http://www.dostips.com/forum/viewtopic.php?p=9611

-OR-

processing text file:

for /f "useback tokens=* delims=" %%# in ("c:\text.file") do (
    set "current_line=%%#"
)

more info here: http://ss64.com/nt/for_f.html

Upvotes: 2

Related Questions