问题
I have an "old-good" fortran.exe file (without access to the code) and I need to execute a few hundred times using a batch file.
However, at the end of the fortran program, it prints "Press ENTER to exit", interrupting, of course, the execution of the batch file...
Is there a way to send the {ENTER} to the running program?
回答1:
check the sendkeys.bat. The script is capable to send a keys to running program with particular title:
call sendkeys.bat "fortran-program" "{ENTER}"
EDIT
try with this script
call nonsecureSendKeys.bat "progfortr" "{ENTER}"
回答2:
I had the problem recently and this is the easiest/fastest working solution I found:
echo & echo.|fortran.exe
You pipe-in "& echo." (new line) inside the keyboard buffer, waiting to be consumed by the executable.
回答3:
This does not work for the no windowed programs.
Because you should do This : .AppActivate(title).
For the programs run without any window,you can't activate it.
来源:https://stackoverflow.com/questions/36481176/batch-send-enter-key-to-running-program