// An highlighted block
import os
import subprocess
rootdir=os.path.join('D:\SPI1')#写自己的路径
for (dirpath,dirnames,filenames) in os.walk(rootdir):
for filename in filenames:
if os.path.splitext(filename)[1]=='.txt':
proc = subprocess.Popen('SPI_SL_6.exe', stdin=subprocess.PIPE)
proc.stdin.write(b"3\n")
proc.stdin.write(b"1\n")
proc.stdin.write(b"3\n")
proc.stdin.write(b"12\n")
proc.stdin.write(b"SP1/"+filename.encode()+b"\n")#写自己的路径
proc.stdin.write(b"SP2/"+filename.encode()+b"\n")#写自己的路径
proc.stdin.flush()
proc.stdin.close()
使用python调用exe并输入参数(通常用于批处理)
最新推荐文章于 2024-06-17 15:25:33 发布