Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 此时意外出现批处理文件错误goto_Batch File_Cmd - Fatal编程技术网

Batch file 此时意外出现批处理文件错误goto

Batch file 此时意外出现批处理文件错误goto,batch-file,cmd,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.

我知道这个问题以前已经得到了回答,但我已经编写了相当大的代码,我似乎无法找到错误。基本上,我只是要求你们阅读这些代码并找出错误。多谢各位

@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%
哇,大概花了一个小时才把它放到正确的位置。

1。)不要用数字作为变量名。2.)使用
if/i
简化代码。3.)这不是调试器服务。提示:你的主要问题是1.1)好的,谢谢。2) 我不知道那个命令,你能给我解释一下吗?3) 对不起,你什么意思?4) 第1点在哪里?1)不是为了这个。2.
/i
忽略大小写。因此,您可以检查
。。。只有一个如果。请参见
if/?
3。)像“这里有很多代码,请查找错误”这样的问题通常会导致问题结束。4.)第1点是第一点(即“不要将数字用作变量名”)