1.

Solve : capture a line at a time from a txt file?

Answer»

does ANYONE know how to CAPTURE a line of a text file from DOS

example text file:

marco
paul
linda


I'm looking to READ the first line then set it equal to a variable in my batch file then read the next line in the second loop etc....The answer would depend on the operating system you are talking about.  The following line will display each line in a text file (called sample.txt) if running a DOS window under Windows 2000 (all on one line):

for /f "tokens=1, 3* delims=~" %G IN (sample.txt) DO echo %G%H%I

If the preceeding command is run in a batch file, the references to variables %G, %H, %I would be %%G, %%H, %%I.

This command is not available in MSDOS 3-6.



Discussion

No Comment Found