如何调用从批处理文件/运行多个Python脚本窗口XP / 7 [英] how to call / run multiple python scripts from batch file in window xp / 7

查看:573
本文介绍了如何调用从批处理文件/运行多个Python脚本窗口XP / 7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试使用批处理文件来安排运行多个蟒蛇。

I'm trying to schedule run multiple pythons using batch file.

例如有,我想安排在每天的基础上运行他们我的Python文件

For example there are my python files that I want to schedule run them on the daily basis

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

现在我怎么能这两个文件合并成一个.BAT,这样我可以安排运行这两个文件中使用 python.exe Ç :\\ python27 \\ python.exe )的同时

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.

感谢您

推荐答案

方法1 :.bat文件

如果您在PATH环境变量的Python:

If you have python in the PATH Environment variable:

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

否则字面路径

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 /? for more help and options.

方法2 :两种不同的任务计划

Method 2: Two different Scheduled Tasks

创建开始在同一时间打电话蟒蛇两个独立的计划任务运行脚本之一。

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

这篇关于如何调用从批处理文件/运行多个Python脚本窗口XP / 7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆