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':
# write_path.write('要写的绝对路径'+filename+'\n')
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-05-17 15:13:44 发布