标题: 取代回车的命令
[打印本页]
作者: 26933062
时间: 2007-1-10 11:07
标题: 取代回车的命令
set /p a=
goto %a%
:w
exit
:d
dir
如上 我输入变量a的值以后还要按一下回车,请问有什么办法可以省略回车吗?[/size]
作者: vkill 时间: 2007-1-11 01:22
不可以
作者: lxmxn 时间: 2007-1-11 02:46
那什么时候你的输入就完了呢?
作者: kk2008 时间: 2007-1-11 03:22
Quote: |
Originally posted by lxmxn at 2007-1-11 02:46 AM:
那什么时候你的输入就完了呢? |
|
如果是只接收一个字符!只要输入一个字符就完了!
作者: lxmxn
时间: 2007-1-11 03:39
Quote: |
Originally posted by kk2008 at 2007-1-10 14:22:
如果是只接收一个字符!只要输入一个字符就完了! |
|
批处理好像不能实现这个。
作者: zh159
时间: 2007-1-11 03:52
可以考虑用2003的choice(自己在论坛上搜索):
@echo off
setlocal EnableDelayedExpansion
choice /C 1234567890abcdefghijklmnopqrstuvwxyz /N /M " 选择: "
for %%n in (1 2 3 4 5 6 7 8 9 0 a b c d e f g h i j k l m n o p q r s t u v w x y z) do (
set /a num+=1
if "%errorlevel%" == "!num!" echo %%n
)
pause
作者: 26933062
时间: 2007-1-11 07:46
多谢,我这样搞定了
@echo off
choice /c:wd w,d
if errorlevel 2 goto d
if errorlevel 1 goto w
:w
exit
:d
dir