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 f1.txt C:\Users\Darek\test2>echo f3.txt f3.txt 

while i'd rather expected just:

f1.txt f3.txt 

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

1 Answer

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.)

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy