In <f9d6e83d-d8e7-4245-a02f-906557263...@googlegroups.com> Karim Farokhnia 
<karim.farokh...@gmail.com> writes:

> Hi there,

> I am writing a batch file in Python. The batch file, in part, calls a
> program named "oq-console.bat" to run. Then once the program comes up
> (it looks like windows CMD), I need the batch file to type some commands
> to make it run (just like I would do it by myself).

If you need to start up a program, provide interactive input to it, and
perhaps examine its interactive output, then you want the "pexpect" module:

    Pexpect is a pure Python module for spawning child applications;
    controlling them; and responding to expected patterns in their output.
    Pexpect allows your script to spawn a child application and control it
    as if a human were typing commands.

    https://pexpect.readthedocs.io/en/stable/

-- 
John Gordon                   A is for Amy, who fell down the stairs
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to