|
airayuu
初级用户
 
积分 27
发帖 12
注册 2006-9-15
状态 离线
|
『楼 主』:
求助,如果在批处理中实现等待用户输入?
使用 LLM 解释/回答一下
在批处理执行过程中,等待用户输入,
本来想使用set/p xxx=yyy 来实现,不过发现没有效果,在纯DOS下没有/P参数。
有没有其他办法?不能是CHOICE,因为要输入的字符数大于2个以上。
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.
|
|
2007-12-6 01:02 |
|
|
Climbing
铂金会员
       网络独行侠
积分 6962
发帖 2753
注册 2003-4-16 来自 河北保定
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
纯DOS下确实不支持set /p,只好使用第三方的程序了。例如wbat。
Under pure DOS, set /p is indeed not supported, so we have to use third-party programs. For example, wbat.
|

偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
|
|
2007-12-6 10:19 |
|
|
knightak
初级用户
 
积分 35
发帖 17
注册 2008-4-3
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
仅供参考:
--------------------------
REPLY.COM 批处理文件中用于允许用户输入来控制程序流的程序。 例如, 以下 AUTOEXEC.BAT 文件允许您确定是否要在启动期间安装鼠标驱动程序:
@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
要创建 REPLY.COM, 输入文本指令列中列出。 每个指令后按 Enter。 请不要输入文本注释列中列出 ; 它是供您参考。
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
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
|
|
2008-4-4 10:34 |
|
|
chishingchan
银牌会员
    
积分 1282
发帖 538
注册 2002-11-2
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
3楼请解释一下返回值的含义,让大家学习一下。
Please explain the meaning of the return value on the 3rd floor to let everyone learn.
|
|
2008-4-6 16:06 |
|
|
abcd
银牌会员
    
积分 1436
发帖 739
注册 2007-10-11
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
3楼的汇编只能输入一个字符的
通过21号中断的8号功能读取一个字符,保存在al寄存器中。这个结果就是errorlevel中的值。
而那些121、89、110、78分别对应字母y和n的大小写的ASCII码的十进制值。
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.
|
|
2008-4-7 01:26 |
|