Question

On OpenVMS, it is possible to write DCL (DIGITAL Command Language) command scripts that interpret lines without the $ prompt as input to the preceding command.

For example, let's assume that we have a simple application ADD.EXE that asks for input to two questions, "Enter first value:" and "Enter second value:", and then displays the sum of these two values. Then in OpenVMS DCL it would be possible to write a command script ADD.COM like this:

$ RUN ADD.EXE
5
7

When this command script is executed (by typing @ADD.COM if I remember correctly), the output would be

12

I have tried to find a way to do the same using Windows batch scripts, but so far without success. Can it be done using batch scripts, or is there any alternative approach of accomplishing this under Windows?

Was it helpful?

Solution

There is no direct replacement of this OpenVMS feature, but the work-around is very simple:

(
echo 5
echo 7
) | add.exe

This generate a temporary file with two lines and pipe it to the input of ADD.EXE

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top