简体   繁体   English

如何在窗口xp / 7中从批处理文件调用/运行多个python脚本

[英]how to call / run multiple python scripts from batch file in window xp / 7

I'm trying to schedule run multiple pythons using batch file. 我正在尝试使用批处理文件安排运行多个pythons。

For example there are my python files that I want to schedule run them on the daily basis 例如,我想安排我的python文件每天运行它们

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

now how can I combine these two files into a .bat, so that I can schedule run these two file using python.exe ( C:\\python27\\python.exe ) at the same time. 现在我如何将这两个文件组合成一个.bat,以便我可以同时使用python.exeC:\\python27\\python.exe )安排运行这两个文件。

Thank you 谢谢

Method 1 : Bat file. 方法1 :Bat文件。

If you have python in the PATH Environment variable: 如果你在PATH环境变量中有python:

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

Else literal path 其他字面路径

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

Note that this will not wait for a return from either execution. 请注意,这不会等待任何执行返回。 Note, do not forget to add quotations around the path strings if they contain spaces or special characters. 注意,如果它们包含空格或特殊字符,请不要忘记在路径字符串周围添加引号。

See start /? start /? for more help and options. 获得更多帮助和选择。

Method 2 : Two different Scheduled Tasks 方法2 :两个不同的计划任务

Create two separate scheduled tasks that start at the same time each calling python to run one of the scripts. 创建两个单独的计划任务,每个任务在每次调用python的同时启动,以运行其中一个脚本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM