我有一个选择菜单,由于某种原因正在崩溃。编码:
: uninstallerMenu
echo REMOVE ME! total items %count%
set uninstallNr=
set /P uninstallNr=Please select a number:
echo %uninstallNr%
if /I %uninstallNr% LEQ %count% goto uninstaller
if /I '%uninstallNr%'=='M' goto menu
:: Uninstaller Error Handler
: uninstallerError
cls
echo.
echo ==================== INVALID INPUT ====================
echo _______________________________________________________
echo.
echo Please select a number or 'M' to go to Main Menu
echo _______________________________________________________
echo.
echo ============== PRESS ANY KEY TO CONTINUE ==============
pause>null
cls
if '%opt%'=='64' goto progList64
if '%opt%'=='32' goto progList32
goto menu
问题在于小于或等于检查。如果我输入 %uninstallRn% LEQ %count% 它会检查它并将其发送给卸载程序,如果它是真的,按 M 键会做它应该做的事情,但是按 enter 键会破坏脚本。
现在如果我添加
if '%uninstallNr%'=='' goto uninstallerError
前
if /I %uninstallNr% LEQ %count% goto uninstaller
if /I '%uninstallNr%'=='M' goto menu
然后一切都进入uninstallerError部分?!?!我究竟做错了什么?