I'd like to write simple Windows batch line - a loop that iterate through a file line by line and for each line just prints that line. Here i what a have:

for /F "usebackq tokens=*" %f in ("del.txt") do echo %f

But that outputs:

C:\Users\Darek\test2>echo f1.txt

C:\Users\Darek\test2>echo f3.txt

while i'd rather expected just:


Why does it prints also the C:\Users\Darek\test2>echo ... for each line?

1 Answer 1


Because you don't disable echo of commands.

Put as the first line of your script

@echo off

(@ before command is to not echo this command itself.)

  • Ok, got it, but now i have: for /F "tokens=*" %f in (del.txt) do if EXIST FolderA\%lf @echo "%f - OK" and i get C:\Users\Darek\test2>echo ... although the echo is disabled!
    – Daros911
    Jan 16, 2021 at 14:43
  • First line of your batch file: @echo off. Second line: your command for /F "tokens=*" %%f in (del.txt) do if EXIST FolderA\%lf echo "%%f - OK".
    – MarianD
    Jan 16, 2021 at 15:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .