I have .exe file that opens up a command window and waits for user input, let's call it program.exe.
I would like to automatically insert the user input into that running Program.
For example if I write a batch file using this, I would like to start the program and insert the command entered by the user into the command line of the started program.
@echo off
call program.exe
echo command1
This would start the program and "simulate" the input of command1 into the command line of the opened program.
How can I achieve this?
echo command1|program.exe. Whether it works or not depends on how exactly the.exeis programmed.(echo command1&echo command2)|program.exe. But when a single input doesn't work, multiple inputs won't work as well. For your second idea, that can't be done withcmdalone. The help of another language, which has some sort ofSendKeycommand is needed (like for examplevbs)program.exe<command.txtwherecommand.txtholds comand1 or whatever, proved thatprogram exeaccepts such input