Batch files: How to read a file?

Lucas Gabriel Sánchez picture Lucas Gabriel Sánchez · Oct 15, 2008 · Viewed 401.2k times · Source

How you can read a file (text or binary) from a batch file? There is a way to read it in a binary mode or text mode?

Answer

devio picture devio · Oct 15, 2008

Under NT-style cmd.exe, you can loop through the lines of a text file with

FOR /F %i IN (file.txt) DO @echo %i

Type "help for" on the command prompt for more information. (don't know if that works in whatever "DOS" you are using)