import subprocess
import time
# import optparse
# parse = optparse.OptionParser(usage=""usage:%prog [options] arg1,arg2"", version="%prog 5.0")
# parse.add_option("-f", "--file", dest="file", action="store", type=str, metavar="file", help="请输入配置文件地址")
# options, args = parse.parse_args()
# cmd = ["test.py","-f","info2 "]
# subprocess.call(cmd,shell=True)
# time.sleep(1)
# subprocess.call("test.py -f infotest ",shell=True)
file = input("请输入配置文件(如:auto.txt):")
file = file if file!="" else "auto.txt" # 默认 auto.txt
with open(file,"r",encoding="utf-8") as f:
cmd_content = f.read()
for cmd in cmd_content.split(" "):
cmd_shell = cmd.split(",")
print("cmd run:%s" % " ".join(cmd_shell))
subprocess.call(cmd_shell, shell=True)
print(".1秒后执行下一个任务")
time.sleep(.1)
input("auto run success")
如果本文对您有所帮助,请支持下本站哦!!!^_^