in reply to Command Line Program Wrapper

Sounds like you're looking for Expect.