Board logo

标题: [求助] 检查输入字符的问题 [打印本页]

作者: chishingchan     时间: 2007-11-27 20:15    标题: [求助] 检查输入字符的问题
批处理
:input
set /P OK=请输入盘号:
if %OK%==U goto :Restore
if %OK%==u goto :Restore
if not exist %OK%\nul goto :input
.
.
.
:Restore


现确定为以下这两行出错,请问怎样修改才算正确?
if %OK%==U goto :Restore
if %OK%==u goto :Restore

作者: AlexZhang     时间: 2007-11-27 20:44
@echo off
set /P OK=请输入盘号:
if %OK%==U goto :Restore
if %OK%==u goto :Restore
if not exist %OK%\nul goto :input
:Restore
@echo 123

:input
@echo Input

这个意思么?

作者: murong     时间: 2007-12-4 23:27
:input
set OK=0
set /P OK=请输入盘号:
if /i "%OK%"=="U" goto Restore
if not exist %OK%\nul goto input

:Restore
pause

作者: billow     时间: 2007-12-6 14:46
对,字符串比较需要用双引号括起来

作者: chishingchan     时间: 2007-12-10 17:23
谢谢!后来知道了。