home *** CD-ROM | disk | FTP | other *** search
- @echo off
-
- echo.
- echo ┌────────────────────────────────────────────────────────────────────┐
- echo │ Demonstrate that it is possible to give input to a pure batch file │
- echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sat 22-Feb-1992 │
- echo └────────────────────────────────────────────────────────────────────┘
- echo.
-
- echo Give your reply as set r=YourReply terminated by ^Z (and Enter)
- rem Read from the keyboard into a temporary auxiliary file
- copy con replytmp.bat > nul
-
- rem Set the r environment variable
- if exist replytmp.bat call replytmp.bat
-
- rem Get rid of the temporary file
- del replytmp.bat > nul
-
- rem Branch in accordance to the reply
- for %%i in (y Y yes YES) do if %%i==%r% goto _yes
- for %%i in (n N no NO) do if %%i==%r% goto _no
- goto _indef
-
- :_yes
- echo Your reply was a "Yes"
- goto _out
-
- :_no
- echo Your reply was a "No"
- goto _out
-
- :_indef
- echo Your reply was indefinite
-
- rem That's all folks
- :_out
- set a=
- echo on
-