我运行 python 命令
python file.py inputfile.STL
但我想将其扩展为一次输入多个文件。我如何制作一个 Windows 批处理文件,运行时将为该目录中的每个 *.STL
文件运行一个命令。例如,它将运行,
python file.py INPUTFILE1.stl
python file.py ANOTHERFILE.stl
python file.py BLAH.stl
....
请注意,.STL 文件将具有不同的前缀。
最佳答案
这些主题可以提供帮助:Batch script loop和 batch file Copy files with certain extensions from multiple directories into one directory
所以基本上:
for %f in (*.stl) do python file.py %f
这将创建一个循环,执行目录中扩展名为 .STL 的所有文件。
关于python - 批处理文件: Run command for every file of certain extension,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19951271/