中国DOS联盟论坛

中国DOS联盟

-- 联合DOS 推动DOS 发展DOS --

联盟域名:www.cn-dos.net  论坛域名:www.cn-dos.net/forum
DOS,代表着自由开放与发展,我们努力起来,学习FreeDOS和Linux的自由开放与GNU精神,共同创造和发展美好的自由与GNU GPL世界吧!

游客:  注册 | 登录 | 命令行 | 会员 | 搜索 | 上传 | 帮助 »
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » [求助] 98 下 choice 的问题。。谢谢
作者:
标题: [求助] 98 下 choice 的问题。。谢谢 上一主题 | 下一主题
pingfan5666
初级用户





积分 38
发帖 20
注册 2009-5-11
状态 离线
『楼 主』:  [求助] 98 下 choice 的问题。。谢谢

[求助]  98  下 choice 的问题。。谢谢

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

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

怎么样,,才能叫它一定要输入maxdos  才能进行下一步,哪位大大,,帮忙,,谢谢,,以前很早就看到这个问题,,没用DOS命令很久,现在想重新学学。。。

2009-5-19 05:59
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
DOSforever
金牌会员





积分 4633
发帖 2236
注册 2005-1-30
状态 离线
『第 2 楼』:  

choice 就是这样的,只接受单个字符的按键。要想接受字符串输入得用其它第三方工具。



DOS倒下了,但永远不死
DOS NEVER DIES !

投票调查:
http://www.cn-dos.net/forum/viewthread.php?tid=46187

本人尚未解决的疑难问题:
http://www.cn-dos.net/forum/viewthread.php?tid=15135
http://www.cn-dos.net/forum/viewthread.php?tid=47663
http://www.cn-dos.net/forum/viewthread.php?tid=48747
2009-5-21 00:25
查看资料  发短消息 网志   编辑帖子  回复  引用回复
pingfan5666
初级用户





积分 38
发帖 20
注册 2009-5-11
状态 离线
『第 3 楼』:  

有哪些这样的工具啊,,介绍一下。。谢谢。。

2009-5-22 07:47
查看资料  发送邮件  发短消息 网志   编辑帖子  回复  引用回复
DOSforever
金牌会员





积分 4633
发帖 2236
注册 2005-1-30
状态 离线
『第 4 楼』:  

我现在都是用 4DOS 的 input 命令

  Quote:

4DOS Help Topic:  INPUT


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

Format:   INPUT [/C /D /E /Ln /N /P /Wn /X] [prompt] %%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倒下了,但永远不死
DOS NEVER DIES !

投票调查:
http://www.cn-dos.net/forum/viewthread.php?tid=46187

本人尚未解决的疑难问题:
http://www.cn-dos.net/forum/viewthread.php?tid=15135
http://www.cn-dos.net/forum/viewthread.php?tid=47663
http://www.cn-dos.net/forum/viewthread.php?tid=48747
2009-5-24 07:12
查看资料  发短消息 网志   编辑帖子  回复  引用回复

请注意:您目前尚未注册或登录,请您注册登录以使用论坛的各项功能,例如发表和回复帖子等。


可打印版本 | 推荐给朋友 | 订阅主题 | 收藏主题



论坛跳转: