June 27, 200719 yr I have a batch script that calls a program and runs it. The exe wants the user to hit the enter key before quitting and then letting the batch go on. I do not have a pause in the script it the prompt is hard coded into the program. How do I get the script to enter a literal enter key so that it can complete the program and go on with the script?
June 27, 200719 yr here's an old dos trick, don't know if it will work for you or not. use at your own risk.create a text file with a single carriage return and save it as cr.txt.change your cmd line to the following:mycommand.exe <<cr.txtthe program will run and the redirection will take the contents of the file and load it into the input buffer, when the window comes up the button would take the carraige return and then close. Might work might not.Otherwise create an autoit script and run the program from it and have autoit watch for the window and then press the button automatically.
June 29, 200719 yr Author I have a program that parses a csv into other csv files so that they can be imported into sql. The executable prompts when it is complete to hit any key which actually is the enter key that it really wants. I am trying to get around having to change the source code of the program and recompile because of internal costs of doing so.
June 29, 200719 yr Will it take any other key but enter?Or did you try writing an autoit script that watches for the window to appear and then sends it the enter key.
July 1, 200719 yr if you want to post (or PM) the exe i can probably remove the "press any key" thing for you.
July 1, 200719 yr Another trick, similar to IcemanND's one is the following:ECHO . |someapp.exeagain, sometimes it works, sometimes not.jaclaz
July 4, 200719 yr The program is not taking input from STDIO, so redirection and pipes are not going to work.You need to use some sort of keystack program, such as 4nt, or quercus rexx etc, which can send keys to a different window. I can't think of any free ones off hand.The other alternative is to look for some sort of switch in the program, such as -quiet or -q or -s or -silent, where the program does not provide any user interaction.
Create an account or sign in to comment