How to run a dos executable from python

L

lblr33

I have an executable (e.g. myprog.exe) which takes some set number of
arguments.

This command works ok:
os.system(r"c:\tmp\myprog.exe arg1 arg2 arg3")

The problem is that the path to the program and the arguments are
variable at runtime so I need to pass them as arguments.

Thanks
 
L

Larry Bates

lblr33 said:
I have an executable (e.g. myprog.exe) which takes some set number of
arguments.

This command works ok:
os.system(r"c:\tmp\myprog.exe arg1 arg2 arg3")

The problem is that the path to the program and the arguments are
variable at runtime so I need to pass them as arguments.

Thanks
Take a look at the subprocess module or on older versions of Python
you can use os.spawn.

Larry Bates
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top