Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
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.
1 Answer
- 1 decade agoFavorite 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.
Source(s): Experience