1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

GOTO parameter

Discussion in 'Suggestions' started by rps, Aug 28, 2017.

  1. rps

    rps

    Joined:
    Jul 6, 2008
    Messages:
    202
    Likes Received:
    3
    Add optional variable to be passed to a GOTO statement, like what is available using GOSUB. example: GOTO label %parm. Don't really know how I would use this even if it is implemented.
     
  2. AnrDaemon

    Joined:
    Aug 23, 2010
    Messages:
    45
    Likes Received:
    1
    CALL :label [params ...]
     
  3. rps

    rps

    Joined:
    Jul 6, 2008
    Messages:
    202
    Likes Received:
    3
    Thanks; I totally missed that in the docs.:oops:

    Not exactly how I envisioned when I wrote the OP, but workable if your careful with where the label is placed in the overall batch file, since using this requires ending the label with quit, exit, cancel or the end of the batch file. :meh:

    I will have to experiment a bit, just in case I ever need to use this feature in an actual btm.

    Thanks again!! :happy:
     
  4. Joe Caverly

    Joined:
    Aug 28, 2009
    Messages:
    676
    Likes Received:
    8
  5. w_krieger

    Joined:
    Nov 2, 2008
    Messages:
    176
    Likes Received:
    0
    I spent a good deal of time thinking how a gosub or goto might work with parameters. In essence, each time a goto or gosub is called, the parameter list would change. If you used %1-%9 here, you would have some difficulty reading what these mean.

    You could also alias `return` to do the exit /b stuff.
     
  6. AnrDaemon

    Joined:
    Aug 23, 2010
    Messages:
    45
    Likes Received:
    1
    ALIAS RETURN=GOTO :EOF

    If you absolutely want to make your scripts unportable.
     

Share This Page