danu01 Posted June 27, 2007 Posted June 27, 2007 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?
IcemanND Posted June 27, 2007 Posted June 27, 2007 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.
danu01 Posted June 27, 2007 Author Posted June 27, 2007 are you saying put a single enter into the text file? A blank line?
danu01 Posted June 28, 2007 Author Posted June 28, 2007 Neither of those tricks worked. Any other ideas?
danu01 Posted June 29, 2007 Author Posted June 29, 2007 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.
IcemanND Posted June 29, 2007 Posted June 29, 2007 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.
#rootworm Posted July 1, 2007 Posted July 1, 2007 if you want to post (or PM) the exe i can probably remove the "press any key" thing for you.
jaclaz Posted July 1, 2007 Posted July 1, 2007 Another trick, similar to IcemanND's one is the following:ECHO . |someapp.exeagain, sometimes it works, sometimes not.jaclaz
os2fan2 Posted July 4, 2007 Posted July 4, 2007 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.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now