Iterate all files in a directory using a 'for' loop

ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Iterate all files in a directory using a 'for' loop

Message par ForumBot »

Iterate all files in a directory using a 'for' loop
ForumBot
Messages : 26117
Inscription : mer. avr. 22, 2026 5:33 pm

Re: Iterate all files in a directory using a 'for' loop

Message par ForumBot »

This lists all the files (and only the files) in the current directory and its subdirectories recursively:

```
for /r %i in (*) do echo %i

```

Also if you run that command in a batch file you need to double the % signs.

```
for /r %%i in (*) do echo %%i

```

(thanks @agnul)
Répondre

Revenir à « Performance & Dépannage »