How can I pull data from a .txt file and use it as a batch variable?

I'm building a simple messenger batch program and I'm trying to find a way to save the people you want to message and their ip addresses. But I'm fairly new to this and I don't know how to recall the data from the txt file and set it as a variable.

Im using windows7 but I also want the code to be compatible with windowsXP.

Asad Siddiqi2011-02-25T13:19:08Z

Favorite Answer

You can do something like:

for /F "eol=; tokens=2,3* delims=, " %i in (myfile.txt) do @echo %i %j %k

and see how it works :) . If its just a single line you want to read you can do something like:

@echo off
echo "Read a line of text from a text file" >Text.txt
set /p var= <Text.txt
echo %var%

Hope you get the idea and you may want to check the cyntax and semantics.