Jump to content

Recommended Posts

Posted

It has been years since I last needed to use a batch file.

But I am trying to created a bootable Dos iso image to mount in ilo for flashing Boot from iscsi Intel i350 T2 cards

I can now type all the commands in my boot from dos

 

so next I thought I would make it easier with a menu in a batch file that calls the 4 batch files I wrote to process the commands

 

my problem is when I run the file below I have to press enter 2 time so for example I select option 2 press enter nothing happens till I press enter again .

 

I have tried several things as you can see from the syntax below none of them work

 

Any ideas??

ECHO OFF

CLS

:MENU

ECHO.

ECHO ...............................................

ECHO PRESS 1, 2 ,3 or 4 to select your task, or 5 to EXIT.

ECHO ...............................................

ECHO.

ECHO 1 - Flash Enable Nic 1

ECHO 2 - Flash Enable Nic 2

ECHO 3 - Enable boot from Iscsi Nic 1

ECHO 4 - Enable boot from Iscsi Nic 2

ECHO 5 - Exit

ECHO.

set /p input="Select number: "

SET /P M=Type 1, 2, 3, or 4 then press ENTER:

IF %input%==1 GOTO flnic1

IF %input%==2 GOTO flnic2

IF %input%==3 GOTO enbnic1

IF %input%==4 GOTO enbnic2

IF %input%==5 GOTO exit

 

 

:flnic1 @echo off

flnic1.bat

pause

GOTO MENU

 

:flnic2

start "" flnic2.bat

GOTO MENU

 

:enbnic1

CALL enbnic1.bat

GOTO MENU

 

:enbnic2

start /wait cmd /k CALL enbnic2.bat

GOTO MENU

 

:exit

exit

Posted (edited)

Try this...

 

@ECHO OFF
CLS
:MENU
ECHO.
ECHO ...............................................
ECHO PRESS 1, 2, 3 or 4 to select your task, or 5 to EXIT.
ECHO ...............................................
ECHO.
ECHO 1 - Flash Enable NIC 1
ECHO 2 - Flash Enable NIC 2
ECHO 3 - Enable boot from iSCSI NIC 1
ECHO 4 - Enable boot from iSCSI NIC 2
ECHO 5 - Exit
ECHO.
SET /P M=Type 1, 2, 3, or 4 then press ENTER:
IF %input%==1 GOTO flnic1
IF %input%==2 GOTO flnic2
IF %input%==3 GOTO enbnic1
IF %input%==4 GOTO enbnic2
IF %input%==5 GOTO EOF

:flnic1
CALL flnic1.bat
pause
GOTO MENU

:flnic2
CALL flnic2.bat
GOTO MENU

:enbnic1
CALL enbnic1.bat
GOTO MENU

:enbnic2
CALL enbnic2.bat
GOTO MENU

Edited by Arthur
Posted

no same result after you select say 2

you get the line press 1,2,4 or4 to select your ask or 5 to Exit

press enter again and it runs the second batch file

 

thanks

Posted

This should do what you need...

 

@ECHO OFF
CLS
:MENU
ECHO.
ECHO ------------------------------------------------------
ECHO  PRESS 1, 2, 3 or 4 to select your task, or 5 to EXIT
ECHO ------------------------------------------------------
ECHO  1 - Flash Enable NIC 1
ECHO  2 - Flash Enable NIC 2
ECHO  3 - Enable boot from iSCSI NIC 1
ECHO  4 - Enable boot from iSCSI NIC 2
ECHO  5 - Exit
ECHO.
SET /P INPUT=Type 1, 2, 3, or 4 then press ENTER:
IF %INPUT%==1 GOTO flnic1
IF %INPUT%==2 GOTO flnic2
IF %INPUT%==3 GOTO enbnic1
IF %INPUT%==4 GOTO enbnic2
IF %INPUT%==5 GOTO EOF
GOTO MENU

:flnic1
CALL flnic1.bat
GOTO MENU

:flnic2
CALL flnic2.bat
GOTO MENU

:enbnic1
CALL enbnic1.bat
GOTO MENU

:enbnic2
CALL enbnic2.bat
GOTO MENU

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...