【发布时间】:2019-09-23 09:26:25
【问题描述】:
set /P id=Enter id:
echo %id%
if %id%=='a'
(
:: DO THINGS1
EXIT
)
if %id%=='b'
(
:: DO THINGS2
EXIT
)
else (
echo Input can be either a or b
)
但每次我运行文件时,即使我给出“a”或“b”作为输入,它也不会进一步执行任何命令,它只要求用户输入并退出。非常感谢您的建议
【问题讨论】:
-
举个例子,我建议:1:
@Choice /C ab /M "What is your ID", 2:@If ErrorLevel 2 (Echo=Do things based upon B entry)Else Echo=Do things based upon A entry -
谢谢。我遇到了不同字符串执行错误的问题
标签: windows batch-file command-line