My guess is that the UDF is not loading.

Output "@ScriptDir\UDF\label.udf"

Is it the valid location of label.udf?

You could also try to just include the text of the UDF in your script.
_________________________
Home page: http://www.kixhelp.com/hb/