While running a batch file in Windows XP I have found randomly occuring error message:
The system cannot find the batch label specified name_of_label
Of course label existed. What causes this error?
While running a batch file in Windows XP I have found randomly occuring error message:
The system cannot find the batch label specified name_of_label
Of course label existed. What causes this error?
If batch file has unix line ends this can sometimes happen.
Just unix2dos it and problem should be solved.
Actually, you need 2 conditions for this to happen:
See. The system cannot find the batch label specified and Batch-as-batch-can!
Here is the issue and how to fix it. The issue is a bug or a feature in DOS batch cmd program. First the clear problem statement. If you have a DOS batch file with target labels like, ":dothis", and at the end of the label you do not have space then the batch file will not work if the line ending are UNIX line endings. This means you have to run unix2dos on the file before you can use it.
The root cause is the DOS command line processor, (shell program), takes the UNIX end-of-line character as part of the label. Since the go to part never uses this as the label, it is never found since such a label truly does not exist. The solution is to put an extra space at the end of each target label, or even better every line. Now UNIX end of lines do not come to play since the space acts as the separator and it all works.