Running and Feeding Input to Interactive Program in Windows from Perl Script

Discussion in 'Perl Misc' started by zemalf, Nov 26, 2006.

  1. zemalf

    zemalf Guest

    I know how to start a program, and get it's output, this is not the
    case. I need to start the program and feed input to it (optionally
    reading the programs output at the same time).

    So, I'm using a program that runs in windows cmd (so I must run the
    script in windows), and all of it's functions can't be executed via
    command line parameters.

    So if I run it "manually" it goes something like this
    c:\>tester -report
    what do you want to check: TEST
    what version you want to check: 2
    what report: A

    ...and then the 'tester' outputs TEST, version 2, report A into screen
    and into file..

    I haven't been able to do this in windows. I've read that it would be
    possible if this was unix, but in windows I can't pipe the program both
    ways, so I can't read the programs output and input it at the same
    Actually it would be enough, if I could just input these to the
    'tester' (I can get the file it outputs automatically with the -report
    1: tester -report (start it)
    2: TEST
    3: 2
    4: A

    the program (1) is always the same, with the -report switch. 2,3 & 4
    might vary

    Can this be done in windows (and with Perl)? If it can be done, how it
    can be done?
    Expect maybe? But I couldn't get verification from documentation that
    it works in Windows as well.
    zemalf, Nov 26, 2006
    1. Advertisements

  2. You are probably looking for the Expect module.

    Jürgen Exner, Nov 26, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.