0

I have a batch script that does things to files with a certain extension in the following format:

for %%f in (*.xxx) do (

...

...

)

How, using the same for loop (I don't want to write one for each filetype as there are many) would I go about making this work for filetypes .xxx, .yyy and .zzz?

1 Answer 1

1

According to the help, for accepts one or more files in set:

Runs a specified command for each file in a set of files.

FOR %variable IN (set) DO command [command-parameters]

  %variable  Specifies a single letter replaceable parameter.
  (set)      Specifies a set of one or more files.  Wildcards may be used.
  command    Specifies the command to carry out for each file.
  command-parameters
             Specifies parameters or switches for the specified command.

[...]

Therefore, you can do it like this:

for %%f in (*.xxx *.yyy *.zzz) do (

    rem (your commands here)

)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.