Windows 我的批处理文件代码有什么问题

Windows 我的批处理文件代码有什么问题,windows,batch-file,cmd,Windows,Batch File,Cmd,我试图找出为什么我的文件在打开时会立即退出 我在猜数字游戏 @echo off set morl="Between 1 and 100" :menu cls echo 1) Start echo 2) Instructions set /p option= if %option%==1 goto loop if %option%==2 goto instructions goto error :error cls echo Enter 1 or 2 pause goto menu :instru

我试图找出为什么我的文件在打开时会立即退出

我在猜数字游戏

@echo off
set morl="Between 1 and 100"
:menu
cls
echo 1) Start
echo 2) Instructions
set /p option=
if %option%==1 goto loop
if %option%==2 goto instructions
goto error
:error
cls
echo Enter 1 or 2
pause
goto menu
:instructions
cls
echo 1. Enter a number
echo 2. It will say higher or lower
echo 3. Repeat based on step 2
pause
:loop
cls
echo Loading...
set num=%random% 
if /i %num% GTR 10 goto loop
if /i %num% LSS 1 goto loop 
goto start 
:start
cls
echo The answer is %morl%
set /p input=
if %input%==%num% goto win
if %input% lss %num% set morl="higher"
if %input% gtr %num% set morl="lower"
goto start
:win
cls
echo You won! the answer was %num%
pause
goto menu

您需要调用菜单功能

@echo off
set morl="Between 1 and 100"
goto menu
:menu
cls
echo 1) Start
echo 2) Instructions
set /p option=
if %option%==1 goto loop
if %option%==2 goto instructions
goto error
:error
cls
echo Enter 1 or 2
pause
goto menu
:instructions
cls
echo 1. Enter a number
echo 2. It will say higher or lower
echo 3. Repeat based on step 2
pause
:loop
cls
echo Loading...
set num=%random% 
if /i %num% GTR 10 goto loop
if /i %num% LSS 1 goto loop 
goto start 
:start
cls
echo The answer is %morl%
set /p input=
if %input%==%num% goto win
if %input% lss %num% set morl="higher"
if %input% gtr %num% set morl="lower"
goto start
:win
cls
echo You won! the answer was %num%
pause
goto menu

从来没有用这种语言编码过,所以我猜问题应该是您从未调用过:menuRemove
@echo off
进行调试!!