# Batch Menu - Not Working...what am I missing?

November 1, 2010 at 15:14:49
Specs: Windows XP
 What the heck am I missing. These options always take me into :RENAME section. It looks like the menu may not be working as intended (obviously) but what am I missing with the goto statements?++++++++++++++++++++++++START OF BATCH+++++++++++++++++++++++++++++@echo offcls:MENUecho 1.) The interface needs to be renamed to "LAN"echo 2.) The interface is already named "LAN"echo 3.) Save and Dump NIC Settingsecho 4.) Import NIC Settingsecho 5.) Take me out of this loop!set /p userinp=Choose a number(1-5):if '%unserinp%'=='1' goto RENAMEif '%unserinp%'=='2' goto DUMPif '%unserinp%'=='3' goto DUMPif '%unserinp%'=='4' goto IMPORTif '%unserinp%'=='5' goto END:RENAMEnetsh interface set interface name="Local Area Connection" newname="LAN"echo The Interface should have been renamed. Kindly double check the work.echo Thank Youpausegoto MENU:DUMPnetsh interface dump > c:\int.dmpecho The interface configuration has been dumped to C:\echo Kindly double check the workecho Thank Youpausegoto MENU:IMPORTnetsh exec c:\int.dmpecho The Interface configuration has been importedecho Kindly double check the workEcho Thank Youpausegoto MENU:ENDpausequit+++++++++++++++++++++++++++END OF BATCH+++++++++++++++++++++++++++++

See More: Batch Menu - Not Working...what am I missing?

#1
November 1, 2010 at 15:18:49
 Use double quotes:if "%unserinp%"=="1" goto RENAME ECT...Good Luck.Can I put a question here?

Report •

#2
November 1, 2010 at 15:21:26
 I just replaced all the single quotes with double quotes, it still appears to be ignoring the goto commands, no matter what I do it only takes me through the :RENAME section

Report •

#3
November 1, 2010 at 15:29:29
 Ahh, found it. Time for a spell check.set /p userinp=Choose a number(1-5):if '%unserinp%'=='1' goto RENAMECan I put a question here?

Report •

Related Solutions

#4
November 1, 2010 at 15:32:21

Report •

#5
November 1, 2010 at 15:33:01
 set /p userinp=Choose a number(1-5):goto :%userinp%:1:2...:5=====================================Life is too important to be taken seriously.M2

Report •

#6
November 1, 2010 at 15:36:44
 M2, The only problem with that is that if somebody entered say 7, it would crash. If this is only used by the OP and a few others, maybe that isn't a problem however.Can I put a question here?

Report •

#7
November 2, 2010 at 00:11:01
 @echo off & setLocal EnableDELAYedeXpansionset /p C=1 or 2 ?goto :!C! 2>nul:1echo.one & goto :eof:2echo.two=====================================Life is too important to be taken seriously.M2

Report •

#8
November 2, 2010 at 02:06:56
 It still does crash if someone does input a wrong choice, example 3.This should do it;@echo off:MAINclsset /p C= Choose 1 or 2 : if %C%==1 goto 1if %C%==2 goto 2if not "%C%" equ " a" goto ERROR:1echo ONE & pause & goto EXIT:2echo TWO & pause & goto EXIT:ERRORecho Invalid input, please try again. & pause & goto MAIN:EXITexitHappy is ONE who says I am an OttoMAN.

Report •

#9
November 2, 2010 at 02:30:23
 You can't idiot-proof everything.You could use CHOICE.EXE which sits there until an allowed key is pressed.=====================================Life is too important to be taken seriously.M2

Report •