2

I run a python command

python file.py inputfile.stl

but I want to expand it to input several files at a time. How would I make a windows batch file that when ran, will run a command for every *.stl file in that directory. So for example it will run,

python file.py INPUTFILE1.stl
python file.py ANOTHERFILE.stl
python file.py BLAH.stl
....

Please note that the .stl files will have a different prefix.

Bijan
  • 6,011
  • 13
  • 64
  • 120

1 Answers1

2

These topics can help: Batch script loop and batch file Copy files with certain extensions from multiple directories into one directory

So basically:

for %f in (*.stl) do python file.py %f

That will create a loop which executes all files in the directory with a .stl extension.

Community
  • 1
  • 1
  • Not quite, the .stl files do not have the same name (prefix). So one of them can be called abc.stl while the other can be testing.stl – Bijan Nov 13 '13 at 10:35
  • Ah ok, the question just changed :). When I looked it was still INPUTFILE1.stl, INPUTFILE2.stl, ... – Gert-Jan Peeters Nov 13 '13 at 10:40