Jump to content

Batch Script

Recommended Posts

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?

Link to comment
Share on other sites

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.txt

the 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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.

  • Create New...