mcclapyohandz
mcclapyohandz

Reputation: 13

Using a for loop Windows batch executes twice

So I'm trying to loop through folders and files in order to command on all of them.

for /d %%i in (*) do echo %%i

However the folder appears to be listed twice:

echo test
test

How do I fix it?

Upvotes: 1

Views: 264

Answers (1)

woxxom
woxxom

Reputation: 73616

Disable displaying of the commands before execution:

  • add @echo off as the first line of the batch file
  • or prefix the command with @, for example: @echo %%i

Upvotes: 3

Related Questions