当前位置: 移动技术网 > IT编程>脚本编程>Python > python多线程方式执行多个bat代码

python多线程方式执行多个bat代码

2017年12月12日  | 移动技术网IT编程  | 我要评论

一生的忠告,天然气管道,豹龟感冒

python多线程方式执行多个bat的代码,感兴趣的朋友可以参考下。

import threading
from win32api import *

class MyThread(threading.Thread):
  def __init__(self, bat_path, **kwargs):
    threading.Thread.__init__(self, **kwargs)
    self.bat_path = bat_path
    
  def run(self):
    ShellExecute(0, None, self.bat_path, None, "c:", True)
  
for i in range(1,4):
  t = MyThread("c: est" + str(i) + ".bat")
  t.start()

以上就是本文的全部内容,希望对大家学习python程序设计有所帮助。

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网