How to automate user input at the command prompt?

Roger Upole rupole at hotmail.com
Fri Jul 21 19:11:11 EDT 2006
If you have the Pywin32 extensions installed, you can use the
win32console module to send keystrokes directly to a command
prompt via WriteConsoleInput.

        Roger

<gert365 at yahoo.com> wrote in message news:1153507940.993009.235310 at 75g2000cwc.googlegroups.com...
>
> I'm working on a scirpt to be used on a windows machine and I need to
> automate a user's input on the command prompt.  For example I'm using
> os.system('mycommand') to excute the commands I want.  However some of
> these command will prompt for a confirmation of yes or no from user.
> Is there anything in python that will allow my script to automate these
> input
> Another example is let  say if i type "format c:\" on the command
> prompt it will warn me and ask me to type 'y' to continue.  I can use
> the os.system to automate the "format c:\" but is there a way to
> automate the 'y' input part.  I try searching for help on the Interent
> but cant seem find any info on how to do this with Python.  Can someone
> give me some confirmation if what I want to do is possible or not.
> Thanks in advance for any help.
> 





More information about the Python-list mailing list