批处理文件错误goto此时是意外的

时间:2014-03-22 17:54:36

标签: batch-file cmd

我知道这个问题之前已经得到了解答,但我写了很多代码,我似乎无法找到错误。基本上我只是要求你们阅读这些代码并找到错误。谢谢。

@echo off
:menu
set lastpage=menu
Echo Hello, and welcome to the Flashing Project version 2.
Echo First, we need two colors. Please type in the color
Echo of the first flash.
Echo.
set /p 1=Enter black, white, blue, or red: 
cls
Echo Now for the second color.
Echo.
set /p 2=Enter black, white, blue, or red: 
if %1%==black goto 1black
if %1%==Black goto 1black
if %1%==white goto 1white
if %1%==White goto 1white
if %1%==blue goto 1blue
if %1%==Blue goto 1blue
if %1%==red goto 1red
if %1%==Red goto 1red
goto wrong
:1black
if %2%==black goto 1black2black
if %2%==Black goto 1black2black
if %2%==white goto 1black2white
if %2%==White goto 1black2white
if %2%==blue goto 1black2blue
if %2%==Blue goto 1black2blue
if %2%==red goto 1black2red
if %2%==Red goto 1black2red
:1white
if %2%==black goto 1white2black
if %2%==Black goto 1white2black
if %2%==white goto 1white2white
if %2%==White goto 1white2white
if %2%==blue goto 1white2blue
if %2%==Blue goto 1white2blue
if %2%==red goto 1white2red
if %2%==Red goto 1white2red
:1blue
if %2%==black goto 1blue2black
if %2%==Black goto 1blue2black
if %2%==white goto 1blue2white
if %2%==White goto 1blue2white
if %2%==blue goto 1blue2blue
if %2%==Blue goto 1blue2blue
if %2%==red goto 1blue2red
if %2%==Red goto 1blue2red
:1red
if %2%==black goto 1red2black
if %2%==white goto 1red2white
if %2%==White goto 1red2white
if %2%==blue goto 1red2blue
if %2%==Blue goto 1red2blue
if %2%==red goto 1red2red
if %2%==Red goto 1red2red
:1black2black
set c1=07
set c2=07
goto preflash
:1black2white
set c1=07
set c2=70
goto preflash
:1black2blue
set c1=07
set c2=90
goto preflash
:1black2red
set c1=07
set c2=40
goto preflash
:1white2black
set c1=70
set c2=07
goto preflash
:1white2white
set c1=70
set c2=70
goto preflash
:1white2blue
set c1=70
set c2=90
goto preflash
:1white2red
set c1=70
set c2=40
goto preflash
:1blue2black
set c1=90
set c2=07
goto preflash
:1blue2white
set c1=90
set c2=70
goto preflash
:1blue2blue
set c1=90
set c2=90
goto preflash
:1blue2red
set c1=90
set c2=40
goto preflash
:1red2black
set c1=40
set c2=07
goto preflash
:1red2white
set c1=40
set c2=70
goto preflash
:1red2blue
set c1=40
set c2=90
goto preflash
:1red2red
set c1=40
set c1=40
goto preflash
:preflash
set lastpage=preflash
cls
Color 07
Echo Now, when the flashing starts, the only way to stop it is to
Echo click the X button. Are you sure you want to continue?
Echo.
Echo.
Echo.
set /p input=Yes or No (No causes the program to exit): 
if %input%==yes goto flash
if %input%==Yes goto flash
if %input%==no goto exit
if %input%==No goto exit
goto wrong
:wrong
cls
Echo You entered something incorrectly, I am returning you to the
Echo previous page.
goto %lastpage%
哇,花了大约一个小时把它弄到了空位。

0 个答案:

没有答案