加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

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

发布时间:2020-12-16 20:38:24 所属栏目:Python 来源:网络整理
导读:python多线程方式执行多个bat的代码,感兴趣的朋友可以参考下。 import threadingfrom win32api import *class MyThread(threading.Thread): def __init__(self,bat_path,**kwargs): threading.Thread.__init__(self,**kwargs) self.bat_path = bat_path def

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,"c:",True)
  
for i in range(1,4):
  t = MyThread("c: est" + str(i) + ".bat")
  t.start()

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读