MSDOS Batch File "Get Answer" program


tia_chi.gif - 1445 Bytes Have you ever needed to ask the user a question
from an MSDOS Batch file?

Well here is a little proggy that will allow you do just that.

It is a very small, simple program named: GETANS
(designed by me and written by the estimable Kenneth Brody).

Here's how it works:
You set up two very simple .bat files.
The first one uses the GETANS program to ask your question.
The GETANS program creates a new two-line MSDOS .bat file, in the root directory, named \fpchain.bat.
The last thing your first MSDOS .bat file does is to execute this new \fpchain.bat batch file.

So your first .bat program can have as few as two lines:

1- run getans,
2- execute \fpchain

The \fpchain.bat script just sets the environment variable that you have chosen with the answer that the user has given. Then it continues by executing your second batch file which can use the answer. (filePro can pick up the answer with the "GETENV" command or by passing it as a parameter.)

That's it.

The syntax for the getans.exe program is:

getans "question-to-ask-user"   environment_variable_to_set   next_.bat_to_run

Here is a sample:

The first .bat file:
@echo off
getans "Please Enter the Company Name: " company ask2
\fpchain

Assuming the user answers "Small Computer" then getans would generate an \fpchain.bat file that looks like this:
set company=Small Computer
ask2

And finally the second bat file, in this case named "ask2.bat":
@echo off
cls
echo.
echo.
echo You answered that the company name is: %company%.
echo.
pause
\fp\rclerk testfile -s1 -r "%company%"

Download getans.exe Program

Happy questioning,

 

Howie and the Aljex Software Team.