Friday, November 6, 2009

Executing Python From Bat File I Have An Exe File That Takes A Command Line Argument. I Want To Execute It From A Python Script. ?

I have an exe file that takes a command line argument. I want to execute it from a Python script. ? - executing python from bat file

Can I use the command python execfile () and execute the program as follows (the program is Main.exe)
execfile 100 ( "Main.exe)
The Main.exe file takes an integer argument. If that fails, not, as I have in Python? Thank you in advance for any help!

1 comments:

two pi said...

Right idea, wrong command.

execfile wait a Python script file and executes them. This is probably not what you mean.

To compile a program already (like Main.exe) module operating system to run and try os.system:

import os
( "Os.system Main.exe)

The string is the complete command, including parameters that could make the
os.system ( "100 Central") and must be executed with the parameter Main.exe 100

Note that the success of this feature depends on several factors. Your script must be allowed to run the program and the program should be available (either on the street or in the same directory as the script, or if you have a complete path in command) name different effects on different operating systems. I assume you are using Windows, because it spoke a. Exe, which we did.

Post a Comment