How do I make a batch to run this in a loop and execute on each subfolder?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
khaldrogo
Posts: 1
Joined: 19 Mar 2021 03:17

How do I make a batch to run this in a loop and execute on each subfolder?

#1 Post by khaldrogo » 19 Mar 2021 03:21

I have an executable called printfroll.exe that runs on subfolders but not within them and kicks out a report
So if I'm in folder /ABC with Subfolders DEF, GHI and JKL, I would place this exe in /ABC with a command printfroll DEF > DEF.txt, it looks within each subfolder and kicks out a report.
How do I make a batch to run this in a loop and execute on each subfolder?

Squashman
Expert
Posts: 4280
Joined: 23 Dec 2011 13:59

Re: How do I make a batch to run this in a loop and execute on each subfolder?

#2 Post by Squashman » 19 Mar 2021 19:51

FOR /D %%G IN (*) DO printfroll %%G > %%G.txt

Post Reply