How to call / run multiple python scripts from batch file in xp / 7 window

I am trying to schedule multiple pythons to run using a batch file.

For example, there are my python files that I want to schedule, running them on a daily basis

D:\py\s1.py D:\py\s2.py 

Now, how can I combine these two files in .bat so that I can plan to run these two files with python.exe ( C:\python27\python.exe ) at the same time.

thanks

+6
source share
1 answer

Method 1 : Bat file.

If you have python in your PATH environment variable:

 start python D:\py\s1.py start python D:\py\s2.py 

Another literal way

 start C:\python27\python.exe D:\py\s1.py start C:\python27\python.exe D:\py\s2.py 

Please note that this will not wait for a return from execution. Note: Remember to add quotes around the path lines if they contain spaces or special characters.

See start /? For more details. .

Method 2 : two different scheduled tasks

Create two separate scheduled tasks that run at the same time each python caller to run one of the scripts.

+14
source

All Articles