How to automate user input at the command prompt?

gert365 at yahoo.com gert365 at yahoo.com
Fri Jul 21 14:52:21 EDT 2006


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