Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


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?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

are you saying put a single enter into the text file? A blank line?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

if you want to post (or PM) the exe i can probably remove the "press any key" thing for you.

Share this post


Link to post
Share on other sites

Another trick, similar to IcemanND's one is the following:

ECHO . |someapp.exe

again, sometimes it works, sometimes not.

jaclaz

Share this post


Link to post
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.

Share this post


Link to post
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...