Forrest logo
back to the for tool

for:ai:40f06

cmd code for getting list of files in a directory and loop processing one file at a time
$ for %i in (C:\path\to\directory\*.txt) do (echo %i)
try on your machine

This command gets a list of all .txt files in the specified directory and loops through each file, echoing the filename.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.

Questions that are answered by this command:

  • cmd code for getting list of files in a directory and loop processing one file at a time?
back to the for tool