Board logo

标题: 请教个问题 [打印本页]

作者: terrankof     时间: 2007-4-13 00:45    标题: 请教个问题

@echo off
echo w=word e=excel p=powerpnt m=msaccess
@echo off
:cuole
set /p x=请输入后按回车:
goto %x%
:w
start winword.exe
exit
:e
start excel.exe
exit
:p
start powerpnt.exe
exit
:m
start msaccess.exe
exit
这有个问题就是输入错了就关闭
我想怎么能输入错了在重新输入
请高手指点
作者: bjsh     时间: 2007-4-13 02:07

set /p x=请输入后按回车:
后面加一句
if /i not "%x%"=="w" if /i not "%x%"=="e" if /i not "%x%"=="p" if /i not "%x%"=="m" echo 输入错误请重新输入; && goto  cuole
作者: lp1129     时间: 2007-4-13 02:11
@echo off
echo w=word e=excel p=powerpnt m=msaccess
@echo off
:cuole
set /p x=请输入后按回车:
if /i "%x%"=="w" goto w
if /i "%x%"=="e" goto e
if /i "%x%"=="p" goto p
if /i "%x%"=="m" goto m
goto cuole
:w
start winword.exe
exit
:e
start excel.exe
exit
:p
start powerpnt.exe
exit
:m
start msaccess.exe
exit

[ Last edited by lp1129 on 2007-4-12 at 03:04 PM ]
作者: jelle918     时间: 2007-4-14 00:33
学了一点东西