我的剧本
echo "Enter your choice (1 or 2 or 3) :"
set /p dbchoice=
IF %dbchoice EQU 1 (
set dbtype="oracle"
) ELSE (
IF %dbchoice EQU 2 (
set dbtype="sqlserver"
)
) ELSE (
IF %dbchoice EQU 3 (
set dbtype="db2"
)
) ELSE (
echo "Incorrect choice"
)
我得到以下输出:
E:\csmilm>set /p dbchoice=
1
ELSE was unexpected at this time.
E:\csmilm>) ELSE (
E:\csmilm>
这里有什么问题?
答案 0 :(得分:11)
在错误的地方关闭括号。 尝试:
IF %dbchoice EQU 1 (
set dbtype="oracle"
) ELSE (
IF %dbchoice EQU 2 (
set dbtype="sqlserver"
) ELSE (
IF %dbchoice EQU 3 (
set dbtype="db2"
) ELSE (
echo "Incorrect choice"
)
)
)