简体   繁体   中英

Execute exe-file with bat-file from Python

I have an exe-file that I need to run several times with different parameters. I can manually (or with Python) create a bat-file with all the parameters and then run the exe-file

C:\\RAY\\Reflec.exe < test.bat

in a cmd window but I run into problems when I try to make Python run it. The exe-file is executed but it does not take in the parameters in the bat-file. I have tried various ways, eg using os.startfile, subprocess.call, and so on but I can not get it to work. All I achieve is to run the exe-file but then it is waiting for the parameters. I don't get any error messages.

Can someone please help me with the syntax? Thanks.

import os
os.system("D:/Ramesh/test.bat")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM