0

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
)
user1111726
  • 157
  • 2
  • 8
  • 18
  • 6
    1. [**Never** use `:label` nor `:: label-like comment` inside a command block enclosed in `()` parentheses](http://stackoverflow.com/a/32147995/3439404). 2. Pay your attention to [Delayed Expansion](https://ss64.com/nt/delayedexpansion.html). – JosefZ Mar 17 '18 at 19:03
  • "Using GOTO within parenthesis - including FOR and IF commands - will break their context:" https://ss64.com/nt/goto.html – lit Mar 18 '18 at 19:37

0 Answers0