Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Stuck on batch file creation for user input  (Read 4306 times)

0 Members and 1 Guest are viewing this topic.

joeytino

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    Stuck on batch file creation for user input
    « on: March 15, 2012, 06:18:30 PM »
    I'm trying to make a MS-DOS batch file automatically update the firmware on up to 12 HBA cards. (The site has a closet full of HBA's that need updating and this would speed up the process) I've successfully completed the part to select which model to upgrade, but it's been too long to remember how to set up the part where the user inputs how many cards are in the system.

    In the command line of DOSLPCFG download n=1 i=zd282a4.all The n= is where the card number would be so it would run n=1, then loop to n=2, etc until it reaches the user defined number of cards. Initially I created a var called %HBANUM% and I found the portion of the script regarding this on line, but I am missing something or this is not what I need. Where the (??) is where I need something to specify the input range (Currently in=1 is hardcoded so I could work on the portion dealing with card type selection which I am fully aware may also be done incorrectly for this type of batch file.)

    The CONFIRM section simply runs a command to list the HBA's after everything is complete to confirm all cards are at the same firmware level. This part works fine.


    Any assistance would be appreciated, even if just pointing me in the right direction. I can't learn anything if it's all done for me.

    Thanks
    Joe

    REM *****HBA firmware upgrade batch file *****


    :BEGIN
    cls
    echo.
    echo.
    echo                     EMULEX HBA FIRMWARE UPGRADE UTILITY
    echo.
    echo        This utility will upgrade the firmware on the Emulex LPE11000
    echo           (single port) and LPE11002 (Dual port) PCI-E HBA cards
    echo.
    echo                 You can upgrade up to 12 HBA's at one time.
    echo.
    echo              All HBA's MUST be the same type (single or dual)
    echo.
    echo     Otherwise the upgrade will fail on the cards not specified to be
    echo                                 upgraded.
    echo.
    echo  Select HBA Type:
    echo.   
    echo  1=LPE11000 (Single Port)
    echo  2=LPE11002 (Dual Port)

    strings HBATYPE = ASK Model of card to upgrade:

    IF %HBATYPE%== 1  GOTO LPE11000
    IF %HBATYPE%== 2  GOTO LPE11002
    IF %HBATYPE%== "" GOTO ERROR

    REM var HBANUM =  ASK How many HBA's are installed?:
    REM @echo off
    REM set HBANUM=0

    REM:start
    REM if %HBANUM%==  (??) goto CONFIRM
    REM echo %HBANUM%
    REM set /HBANUM +=1
    REM goto start

    REM:end


    :LPE11000
    DOSLPCFG download n=1 i=zd282a4.all

     
    :LPE11002
    DOSLPCFG download n=1 i=zf282a4.all
    pause


    :ERROR
    echo Invalid entry. Try again
    GOTO BEGIN

    :CONFIRM
    cls
    echo.
    DOSLPCFG listhba
    echo.
    echo              Confirm firmware version in all above listed HBA's

    :END

    Lemonilla



      Apprentice

    • "Too sweet"
    • Thanked: 70
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    Re: Stuck on batch file creation for user input
    « Reply #1 on: March 15, 2012, 07:13:14 PM »
    Code: [Select]
    :LPE11000
    DOSLPCFG download n=1 i=zd282a4.all

    :LPE11002
    DOSLPCFG download n=1 i=zf282a4.all
    pause
    you do realize this will run both LPE11000 and
    Code: [Select]
    LPE11002 if you HBATYPE=1? you need a GOTO after
    Code: [Select]
    DOSLPCFG download n=1 i=izd282a4.all (I think, though I've never run across this command)


    Code: [Select]
    REM if %HBANUM% GTR 2 goto CONFIRM
    REM echo %HBANUM%
    REM set /a HBANUM +=1

    edited
    Code: [Select]
    set /HBANUM +=1 to
    Code: [Select]
    set /a HBANUM +=1you forgot the /a part to make it an equation


    edited
    Code: [Select]
    if %HBANUM%== (??) to
    Code: [Select]
    if %HBANUM% GTR 2of you could also use
    Code: [Select]
    if "%HBANUM%" =="3"but this is less accurate.


    Code: [Select]
    strings HBATYPE = ASK Model of card to upgrade:did you mean set /p HBATYPE =Model of cards to upgrade: ?
    'strings' came up as an error when I tried it in cmd.

    Hoped this helped!
    Quote from: patio
    God Bless the DOS Helpers...
    Quote
    If it compiles, send the files.