这是一个愚蠢的问题,但请帮忙,否则我的大脑会爆炸!;)) 一些我不明白的愚蠢的事情......
简而言之:为什么在我选择数字 7(退出)后,返回的 ERRORLEVEL 是正确的,但 GOTO 指定的标签被忽略,而是转到 allTasksReboot 标签...
这是我的“代码”...
@echo off
mode con: cols=150 lines=65
@echo ------------------------------------------------------------------------------------------------
@echo INSTALLATION MENU
@echo ------------------------------------------------------------------------------------------------
@echo [ 1 ].All tasks - Unattended with reboot on finish
@echo [ 2 ].All tasks - Unattended without reboot on finish
@echo [ 3 ].All tasks except Software group - Unattended with reboot on finish
@echo [ 4 ].All tasks except Software group - Unattended without reboot on finish
@echo [ 5 ].All tasks except Java 7 installation - Unattended without reboot on finish
@echo [ 6 ].Install only VNC - Unattended
@echo [ 7 ].Exit
@echo ------------------------------------------------------------------------------------------------
@echo ------------------------------------------------------------------------------------------------
CHOICE /C:1234567 /N /M "Choose number for installation type."
@echo You press: %ERRORLEVEL%
@pause
IF ERRORLEVEL 1 GOTO allTasksReboot
IF ERRORLEVEL 2 GOTO allTasks
IF ERRORLEVEL 3 GOTO allExceptSoftwareReboot
IF ERRORLEVEL 4 GOTO allExceptSoftware
IF ERRORLEVEL 5 GOTO allTasksExceptJava
IF ERRORLEVEL 6 GOTO onlyVnc
IF ERRORLEVEL 7 GOTO scriptend
:allTasksReboot
@echo **************************************************************************
@echo All tasks - Unattended with reboot on finish
@echo **************************************************************************
@pause
goto scriptend
:scriptend
@echo Lets exit...
@pause
:goexit