samedi 17 mars 2018

GOTO statement inside nested if condition in batch file

I am trying to implement a nested GOTO statement as show below. The first GOTO statement (goto start) in the main if condition works fine however the second GOTO statement (goto repeat) does not work as required.

cls
:start 
cscript //nologo SelectSRC_DST.vbs

IF %ERRORLEVEL% EQU 1 (
:repeat
cscript //nologo SelectNBType.vbs
    IF %ERRORLEVEL% EQU 1 (
        cd amd64
        scanstate C:\Users\HP\Desktop\Backup2 /o /c /i:miguser.xml 
        /i:migdocs.xml /localonly
    )

    IF %ERRORLEVEL% EQU 2 (
        ECHO You have selected a Common/Pool Notebook.
    )

    IF %ERRORLEVEL% EQU 3 (
        goto repeat
    )
)


IF %ERRORLEVEL% EQU 2 (
ECHO Load State Comes here !!
)

IF %ERRORLEVEL% EQU 3 (
goto start
)

Aucun commentaire:

Enregistrer un commentaire