4

I am trying to automate a command line program.

The exe file takes one argument to run. For example:

ztac.exe <mode> (where mode options are safe, normal or debug).

To run in debug mode I simply type this in the command line:

C:\source>ztac debug

How do I write a Python program to run this ztac.exe file while taking the different modes as inputs?

1 Answer 1

2
program = 'ztac.exe'
arguments = ('safe', 'normal', 'debug')
argument = raw_input('Enter your argument: ')
if argument in arguments:
  subprocess.call([program, argument])
else:
  print('Illegal Argument')
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! That works, however, I cannot run any other code while this is running. there a os.spawn type of implementation that can help me dos this?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.