Skip to content

Batch Script Reading from Files

Learn how to read text files line by line in Windows batch scripts using the for /F loop, including tokenization and handling file paths.

Example

Let's see an example:

@echo off
FOR /F "tokens=* delims=" %%x in (new-file.txt) DO echo %%x

If the file new-file.txt is not present in C:\, it will be created with the previous command.

Navigation