Computing.Net > Forums > Disk Operating System > auto respond to prompt

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

auto respond to prompt

Reply to Message Icon

Name: ezbear
Date: April 30, 2003 at 09:09:19 Pacific
OS: dos 6.0
CPU/Ram: 486
Comment:

I would like to know if there is a way to set up a auto response.
I have a batch file that calls a exe program after that program loads a promt is displayed.
I would like to setup a text file with responses and have them feed the prompt automaticly.



Sponsored Link
Ads by Google

Response Number 1
Name: Robbobob
Date: April 30, 2003 at 16:00:20 Pacific
Reply:

In effect, there is no way to respond to a prompt running in a program because batch files execute the commands in the order specified in the batch file.

However, if the program you are using will accept command line parameters such as you are trying to include in your text file, you can include them either in the bat, or set a new variable as your string of parameters, and then use that variable in your batch file line referencing your program.


0

Response Number 2
Name: Secret_Doom
Date: April 30, 2003 at 21:27:43 Pacific
Reply:

Robbobob wrote:
> In effect, there is no way to respond
> to a prompt running in a program
> because batch files execute the
> commands in the order specified in the
> batch file.

I do not agree. If the program reads input from STDIN (most likely), not specifically from the keyboard, it can be done just fine.

Ezbear, suppose you answer "Yes" to the prompt. This would run the program and automatically answer the prompt "Yes":

echo Yes|prog.exe [parameters]

The strings "prog.exe" and "[parameters]" are just examples of the program name and its parameters.

If there are multiple prompts, you can do it like this (let's say the answers are "Yes" to the first prompt and "Blue" to the second):

@echo off
echo Yes> %temp%.\$
echo Blue>> %temp%.\$
prog.exe [parameters]

However, beware: you won't be able to type in anything else for an eventual third prompt from the program. If the information on the source file (%temp%.\$) is not enough for feeding the program so it completes its process, it will stuck waiting for further input and you won't be able to type it (it will crash, basically). So, you gotta put on the source file all the input that the program will need.

-- Leonardo Pignataro - Secret_Doom --

secret_doom@hotmail.com
www.batch.hpg.com.br


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


Results from a secon batc... Network between MS-DOS &a...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Disk Operating System Forum Home


Sponsored links

Ads by Google


Results for: auto respond to prompt

Computer will not respond to DOS Commands www.computing.net/answers/dos/computer-will-not-respond-to-dos-commands/609.html

rem tshooter when trying to run commands in auto.exe to delete *.tmp files and cookies www.computing.net/answers/dos/rem-tshooter-when-trying-to-run-commands-in-autoexe-to-delete-tmp-files-and-cookies/5198.html

Networking Dos PC / tcptsr hangs www.computing.net/answers/dos/networking-dos-pc-tcptsr-hangs/16037.html