中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --
联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum
游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟
中国DOS联盟论坛
现在时间是 2026-08-15 14:27
47,813 主题排行 / 349,903 发帖 / 今日 1 篇 / 48,257 会员排行
DOS疑难解答 & 问题讨论 (解答室) » [求助] 98 下 choice 的问题。。谢谢
可打印版本  961 / 3
第1楼 pingfan5666 发表于 2009-05-19 05:59
初级用户 发帖 20 积分 38
[求助] 98 下 choice 的问题。。谢谢
[求助] 98 下 choice 的问题。。谢谢

默认 choice 是选择单个字符的,,

choice /c:maxdos/n 像这样,,只要输入m 就行了。。后面的几个就没有了。。

怎么样,,才能叫它一定要输入maxdos 才能进行下一步,哪位大大,,帮忙,,谢谢,,以前很早就看到这个问题,,没用DOS命令很久,现在想重新学学。。。
第2楼 DOSforever 发表于 2009-05-21 00:25
金牌会员 发帖 2,239 积分 4,639
choice 就是这样的,只接受单个字符的按键。要想接受字符串输入得用其它第三方工具。
第3楼 pingfan5666 发表于 2009-05-22 07:47
初级用户 发帖 20 积分 38
有哪些这样的工具啊,,介绍一下。。谢谢。。
第4楼 DOSforever 发表于 2009-05-24 07:12
金牌会员 发帖 2,239 积分 4,639
我现在都是用 4DOS 的 input 命令

4DOS Help Topic: INPUT


Purpose: Get a string from the keyboard and save it in an environment
variable.

Format: INPUT %%varname

prompt: Optional text that is displayed as a prompt.
varname: The variable that will hold the user's input.

/C(lear buffer) /N(o colors)
/D(igits only) /P(assword)
/E(dit) /W(ait)
/L(ength) /X (no carriage return)

See also: INKEY and KEYSTACK.

Usage

INPUT optionally displays a prompt. Then it waits for a specified time or
indefinitely for your entry. It places any characters you type into an
environment variable. INPUT is normally used in batch files and aliases to
get multi-key input. Along with the INKEY command, INPUT allows great
flexibility in reading user input from within a batch file or alias.

If prompt text is included in an INPUT command, it is displayed while INPUT
waits for input. Standard command-line editing keys may be used to edit the
input string as it is entered. If you use the /P password option, INPUT
will echo asterisks instead of the keys you type.

All characters entered up to, but not including, the carriage return are
stored in the variable.

The following batch file fragment prompts for a string and stores it in the
variable FNAME:

input Enter the file name: %%fname

INPUT reads standard input, so it will accept text from a redirected file or
from the KEYSTACK.

If you press Ctrl-C or Ctrl-Break while INPUT is waiting for input,
execution of an alias will be terminated, and execution of a batch file will
be suspended while you are asked whether to cancel the batch job. A batch
file can handle Ctrl-C and Ctrl-Break itself with the ON BREAK command.

In 4DOS you can pipe text to INPUT from another command, which will stash
the first line of the command's output in the specified variable. However,
this trick will not work in 4NT or Take Command, which implement pipes
differently. The @EXECSTR function provides a more portable way to get the
first line of a command's output.

Options

/C: (Clear buffer) Clears the keyboard buffer before INPUT accepts
keystrokes. If you use this option, INPUT will ignore any
keystrokes which you type, either accidentally or intentionally,
before INPUT is ready.

/D: (Digits only) Prevents INPUT from accepting any keystroks except
digits from 0 to 9.

/E: (Edit) Allows you to edit an existing value. If there is no
existing value for varname, INPUT proceeds as if /E had not been
used, and allows you to enter a new value.

/Ln: (Length) Sets the maximum number of characters which INPUT will
accept to "n". If you attempt to enter more than this number of
characters, INPUT will beep and prevent further input (you will
still be able to edit the characters typed before the limit was
reached).

/N: (No colors) Disables the use of input colors defined in the
InputColors directive in 4DOS.INI, and forces INPUT to use the
default display colors.

/P: (Password) Tells INPUT to echo asterisks, instead of the
characters you type.

/W: (Wait) Timeout period, in seconds, to wait for a response. If no
keystroke is entered by the end of the timeout period, INPUT
returns with the variable unchanged. This allows you to continue
the batch file if the user does not respond in a given period of
time. If you enter a key before the timeout period, INPUT will
wait indefinitely for the remainder of the line. You can specify
/W0 to return immediately if there are no keys waiting in the
keyboard buffer.

/X: (No carriage return) Prevents INPUT from adding a carriage
return and line feed after the user's entry.
[ 联系联盟系统管理团队 - 中国DOS联盟 - 标准版 ]
Sponsored by ifanr Inc | © 2001–2023