Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-13713

roscmd cannot exit FOR loop with GOTO

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Major
    • 0.4.15
    • Applications
    • None

    Description

      Report from http://www.msfn.org/board/topic/176999-portabat-portable-batch-environment/?do=findComment&comment=1143742

      test code:

      @ECHO OFF
      SETLOCAL ENABLEDELAYEDEXPANSION
      SETLOCAL ENABLEEXTENSIONS
       
      FOR /L %%A IN (0,1,5) DO (
      SET Number=%%A
      IF %%A==2 GOTO :out_of_loop
      IF %%A==2 ECHO %%A IS equal to 2
      ECHO %%A IS NOT equal to 2
      )
      GOTO :EOF
       
      ECHO.
      ECHO You won't see this
       
      :out_of_loop
      ECHO Here is out of loop, number is %number%
      

       
      Result of roscmd:

      0 IS NOT equal to 2
      1 IS NOT equal to 2
      2 IS equal to 2
      2 IS NOT equal to 2
      3 IS NOT equal to 2
      4 IS NOT equal to 2
      5 IS NOT equal to 2
      Here is out of loop, number is 5
      

      Result of Windows XP cmd:

      0 IS NOT equal to 2
      1 IS NOT equal to 2
      Here is out of loop, number is 2
      

      Attachments

        Issue Links

          Activity

            People

              hbelusca hbelusca
              roytam roytam
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: