Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>** <strong>Note: the <a href="https://stackoverflow.com/revisions/7567680/1">original version of the question</a> asked how to read AND write to a cmd window</strong> **</p> <p><strong>Writing</strong></p> <p>You can write to an existing command window with code such as:</p> <pre><code>from pywinauto import application app = application.Application() app.connect_(path= r"C:\WINDOWS\system32\cmd.exe") dlg = app.top_window_() dlg.TypeKeys('hello world') </code></pre> <p>Notes:</p> <ol> <li><p>I installed the latest version of pywinauto into a Python 2.6 installation direct from the Mercurial repository with the command:</p> <p><code>pip install -e hg+https://code.google.com/p/pywinauto/#egg=pywinauto</code></p></li> <li><p>I would make this rather more robust than assuming the path to cmd.exe! Documentation on selecting the application is at <a href="http://pywinauto.googlecode.com/hg/pywinauto/docs/HowTo.html" rel="nofollow noreferrer">http://pywinauto.googlecode.com/hg/pywinauto/docs/HowTo.html</a></p></li> </ol> <p><strong>Reading</strong></p> <p>Reading from an existing command window appears to be somewhat more difficult! Someone on the <a href="https://lists.sourceforge.net/lists/listinfo/pywinauto-users" rel="nofollow noreferrer">pywinauto-users mailing list</a> has got it working &amp; is offering to post a working example: <a href="http://thread.gmane.org/gmane.comp.python.pywinauto.user/249/focus=252" rel="nofollow noreferrer">http://thread.gmane.org/gmane.comp.python.pywinauto.user/249/focus=252</a> I suggest you get in touch with him.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload