System: Windows 7 64 bit. Interface: cmd.exe.
I need to run an executable in batch. When run in interactive mode, the executable asks for a sequence of commands (each one of course followed by the Enter key) and finally it asks you to press the Enter key to continue (and finish). This last step is blocking me. I managed to write the following:
mycode.exe < batch.txt where the file batch.txt has the following content.
bar.out 28 foo.in summary.out The four lines contain the correct commands mycode.exe. The problem is that I don't know how to send the "Enter" command to mycode.exe...is there a way?
EDIT: maybe I'm not using the right words. I'm not a programmer nor a computer scientist. I'll try with a practical example: if I open a cmd prompt and write (followed by Enter)
D:\test> mycode.exe I get
Enter output file name: I write
bar.out Then I get a list of options among which to choose, and the prompt:
Enter option from menu: I enter
28 I get
Enter input file name: I enter
foo.in I get
Enter summary file: I enter
summary.out Then the code sends a long output to screen, and finally it writes:
Press ENTER to continue If, instead than running it from the command line, I use
mycode.exe < batch.txt I get a Fortran error, so I was thinking that maybe I would need to include the equivalent of pressing the ENTER key, inside my file batch.txt.
1 Answer
Since the program appears to read from the standard input stream, adding a final blank line to batch.txt should do the trick. If it doesn't, then that last prompt is not using standard input, and you'll have to resort to such third-party trickery as SENDKEYS or KEYSTACK.