Typically, I would have to execute a command for each folder separately as shown below:

processdata.cmd C:\data\10-2-2019-run1

processdata.cmd C:\data\10-2-2019-run2

processdata.cmd C:\data\10-2-2019-run3

and so on.

Now, I would like to create a for loop that runs the command for each folder and adds the directory, similar to the previous commands. However, I don’t want the loop to go through sub-folders. Since the folders only contain data, there is no need to exclude any folders or files. I am looking for a simple for loop that uses the Windows CMD (not PowerShell).

Can you please guide me on how to achieve this?

Thank you.

Askify Moderator Edited question April 27, 2023