Reputation: 189
I have a folder where I keep my python scripts used for backing up a particular system. Z:\System Administrator\System Backups\My System\Scripts\
To start them all going I would like to use a .bat file kept in the same folder, however I have zero experience with these files. My reading has lead me to this solution :
@echo off
start /B python "File one.py"
start /B python "It's another file.py"
And if I list every python file in this way then it works as I would want. How can I run all *.py
files that appear in this folder regardless of number or filename ?
Thanks in advance
Upvotes: 1
Views: 1750
Reputation: 5504
That's possible with the following trick:
@echo off
for %%A IN (*.py) do start /b /wait "" python "%%~fA"
Note: For older Windows versions (pre Windows 10) the order is specific. , See here.
Upvotes: 3