0

I have a logic that I need to implement in a directory containing multiple sub-directories and files. Basically I want to execute the same set of commands in some specific sub-directories (name starting with letter 'x'). So far I have tried this in a .bat file.

for /r %%a in (x*) do (
  pushd %%a
    [some command]
  popd 
)

This bat file doesn't run. What am I missing? I tried to refer other similar questions but they did not help either

dbenham
  • 127,446
  • 28
  • 251
  • 390
Shan
  • 71
  • 1
  • 10
  • 1
    `Cmdlet`'s are `PowerShell` not `batch files`. You're missing reading the help information for your command. When you read the output returned from `For /?` you should see a `/D` option. – Compo Oct 30 '18 at 06:11
  • @Compo edited the question – Shan Oct 30 '18 at 07:00
  • Your edit does not take account of all of my advice, once that has been done, and your question edited accordingly, you may receive further help. – Compo Oct 30 '18 at 11:44
  • I suggest you to see [this answer](https://stackoverflow.com/questions/8397674/windows-batch-file-looping-through-directories-to-process-files/8398621#8398621). – Aacini Oct 30 '18 at 13:59

0 Answers0