Reading/Sending From/To a Console Application
I'm using Delphi 2010, and I need to run a console application and automate the tasks that would normally require the user to enter information (for example a password).
So basically I need some way to pipe all the text and read the lines so I know when the applicatio开发者_Python百科n is read for some kind of input, then automatically have my program send the text that the other application needs.
The program I was trying to automate is a Cygwin port of OpenSSH, and I need to enter the password (which isn't displayed when typed) and then press enter.
You can try and get this library uZpRunConsoleApp.pas which contains a really nice class to work with console apps. It will also do what you want it to do, send and receive from a console app to your application.
you can send char by message to the Console window , there is an example : Send To Console
note : it is`t exactly about your question , I made it for other purposes but it will be useful for you ...
good luck ...
精彩评论