![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-19 07:36 |
47,814 topics / 349,908 posts / today 1 new / 48,259 members |
| DOS疑难解答 & 问题讨论 (解答室) » Help, how to implement waiting for user input in a batch script? |
| Printable Version 1,561 / 4 |
| Floor1 airayuu | Posted 2007-12-06 01:02 |
| 初级用户 Posts 12 Credits 27 | |
|
During the execution of the batch processing, wait for user input. Originally, I wanted to use set/p xxx=yyy to achieve it, but found that it didn't work. There is no /P parameter in pure DOS. Is there any other way? It can't be CHOICE because the number of characters to be input is more than 2.
|
|
| Floor2 Climbing | Posted 2007-12-06 10:19 |
| 铂金会员 Posts 2,753 Credits 6,962 From 河北保定 | |
|
Under pure DOS, set /p is indeed not supported, so we have to use third-party programs. For example, wbat.
|
|
| Floor3 knightak | Posted 2008-04-04 10:34 |
| 初级用户 Posts 17 Credits 35 | |
|
For reference:
-------------------------- REPLY.COM is a batch file program used to allow user input to control the program flow. For example, the following AUTOEXEC.BAT file allows you to determine whether to install the mouse driver during startup: @Echo off path=C:\DOS :Ask Echo Install Mouse Driver (y/n)? Reply If errorlevel 121 if not errorlevel 122 goto install If errorlevel 89 if not errorlevel 90 goto install If errorlevel 110 if not errorlevel 111 goto NoMouse If errorlevel 78 if not errorlevel 79 goto NoMouse goto ask :install c:\mouse\mouse :NoMouse cls ver ---------------------- REPLY.COM To create REPLY.COM, enter the instructions listed in the instruction column. Press Enter after each instruction. Please do not enter the instructions listed in the comment column; it is for your reference. Instruction Comment ----------- ------- DEBUG Executes MS-DOS DEBUG utility -A 100 Begin assembling instructions at memory location 100 xxxx:0100 MOV AH,08 Get character input without echo xxxx:0102 INT 21 Perform MS-DOS service xxxx:0104 CMP AL,0 Compare AL with zero xxxx:0106 JNZ 010A If lead zero, get second code of character xxxx:0108 INT 21 Perform MS-DOS service xxxx:010A MOV AH,4C Terminate process with return code xxxx:010C INT 21 Perform MS-DOS service xxxx:010E <ENTER> -rcx CX 0000 :e -n REPLY.COM -w Writing 000E bytes -q |
|
| Floor4 chishingchan | Posted 2008-04-06 16:06 |
| 银牌会员 Posts 538 Credits 1,284 | |
|
Please explain the meaning of the return value on the 3rd floor to let everyone learn.
|
|
| Floor5 abcd | Posted 2008-04-07 01:26 |
| 银牌会员 Posts 739 Credits 1,436 | |
|
The assembly code on the 3rd floor can only input one character.
Read a character through the 8th function of the 21st interrupt, and store it in the al register. This result is the value in errorlevel. And those 121, 89, 110, 78 respectively correspond to the decimal values of the ASCII codes of uppercase and lowercase letters y and n. |
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |