Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


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
Beep
The parameter is passed correctly, but I then get error 3033 label not found.

Answer:

For that trick you need substitution:
	goto script
looks 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:   W13923
Filename:   Using Goto Based on Variable Substitution.txt