Board logo

标题: 请教!关于set /p的变量及跳转问题 [打印本页]

作者: KenDeng     时间: 2010-4-6 11:09    标题: 请教!关于set /p的变量及跳转问题

想用P实现以个选择功能,但是有点问题。特请教!

代码:
@echo off
:begin
echo\
echo\ **************************************
echo\ *******If pass please press "Y" or "y"********
echo\ **If you want to Re-test please press any key**
echo\
set /p in=Please input your choose:
if #%in%#==#y# goto next
if #%in%#==#Y# goto next
goto begin

:next
rem **below is other test**


问题(两个):
首先选择了Y或者y不能直接跳转到:next,我想的是只要我以按Y就直接跳转到:next
其次不至此按空格键。

期待各位大侠的帮助
作者: Hanyeguxing     时间: 2010-4-6 12:37
你的这个P处理运行在什么系统下?
作者: KenDeng     时间: 2010-4-6 12:54
在WindowsXP下CMD里面,或者WinPE(VistaPE)
作者: Hanyeguxing     时间: 2010-4-6 14:11
要想不按回车就能使键入信息生效,推荐使用choice.exe等第三方
作者: KenDeng     时间: 2010-4-10 10:14
RE:Hanyeguxing

我的想法是全部用P来实现。。。
作者: HAT     时间: 2010-4-10 14:02    标题: Re 5 楼

批处理模拟choice命令
http://bbs.bathome.net/thread-4118-1-1.html

一个16字节的批处理版choice
http://bbs.bathome.net/thread-2767-1-1.html