Reputation: 3
There is an example (let us say in a file named mybatch.bat
):
@echo off
myprogram.exe
input_to_myprogram
another_input_to_myprogram
echo myprogram exit point here, so this is just an echo string
When I running myprogram.exe
(it's a simple console application) it asks me to input some string. When I pass a string to it (input_to_myprogram
) it asks me for one more input string (another_input_to_myprogram
). After that myprogram.exe
is terminating, so all other commands in mybatch.bat
are simple shell commands (not an input to myprogram.exe
, because it has been terminated already).
I can use one more file to do the same by replacing call to myprogram.exe
by myprogram.exe < myprogram_input.txt
with myprogram_input.txt
containing
input_to_myprogram
another_input_to_myprogram
but I can use only one file to do this (mybatch.bat
).
So it is possible or not?
Thanks.
Upvotes: 0
Views: 393
Reputation: 2950
You can use echo
to direct the required strings to myprogram.exe:
@echo off
(echo input_to_myprogram & echo another_input_to_myprogram) | myprogram.exe
another_program.exe
Upvotes: 1