startTask.py 405 B

1234567891011121314
  1. import subprocess
  2. filepath="start.bat"
  3. import time
  4. import threading
  5. def start(filepath):
  6. p = subprocess.Popen(filepath, shell=True, stdout=subprocess.PIPE)
  7. stdout, stderr = p.communicate()
  8. print(p.returncode) # is 0 if success
  9. while True:
  10. # 异步
  11. # t = threading.Thread(target=start, args=[filepath]);
  12. # t.start();
  13. #同步,等所有执行完后,再执行