Using GoTo based on Variable Substitution
Keywords: goto variable substitution percent 3033 label not found
Question:
I am new to WinBatch and am trying to GoTo a subroutine based on a passed parameter, e.g, if options are one or two:Script = param1 GoTo Script :one Beep Exit :two Beep BeepThe parameter is passed correctly, but I then get error 3033 label not found.Answer:
For that trick you need substitution:goto scriptlooks for a label of script. What you want is:goto %script%where the contents of the script variable replaces %script%.On the topic of substitution note that "%script%" is the same as plain script.
Article ID: W13923Filename: Using Goto Based on Variable Substitution.txt