DOS批处理文件:如果是其他goto语句理解?

时间:2015-07-06 03:33:29

标签: windows batch-file cmd

制作批处理程序,我似乎遇到了if和else语句的问题。

我试图让它转到另一行,如果还有其他任何事情然后" list"输入。

有谁可以告诉我我做错了什么?

代码:

@echo off
:start
echo PROVOLONE-------------------------
echo ------------------------------TEAM
echo -------------PRESENTS-------------
echo The Simple Batch Program Collection
echo 2015 Provolone Team
sleep 3
echo. 
echo First, let's start off by listing what programs we have.
sleep 2
goto tutorial
:tutorial
echo type in "list"
set /p list="provolone>"
if %list%== "list" goto list else goto wronglist
:wronglist
echo I said type in "list!" not %list% !
sleep 2
goto tutorial
:list
echo.
echo All SBPC Programs as listed
echo starting with program names
echo placeholder
pause

1 个答案:

答案 0 :(得分:0)

引号包含在比较中,因此您需要在比较的两侧使用它们:

if "%list%"== "list" goto list else goto wronglist