Script package for automating a DOS program with settings

I have a console program (DOS program) that requires interactive input. After entering on the command line, for example

commandline.exe /ShowReport 

The DOS prompt will prompt you to enter some values, and then move on to the next interactive input.

For example, when I entered the above command, the console will offer me the following options:

 press '1' to show Report A press '2' to Show Report B 

And I would press '1' if I want to show report A.

Now I want to automate all these things by pre-setting all the input values ​​in the script files. Maybe something like this (I don't know)

 commandline.exe /ShowReport <1<'abc' 

I want to write a script package for this. Are there any tools that let me do this?

+4
source share
2 answers

You can write all your inputs to a file (for example, "input.txt") and use the redirection to feed your program using these inputs:

 commandline.exe /ShowReport < input.txt 

"<tells the command line to use the contents of the file on the right side as standard input.

+3
source

Not a strictly batch solution, but it can do the trick: Expect

See also Wikipedia entry .

0
source

All Articles