Dos - Label (Line)

About

Grammar - Label statement in DOS.

A label is a place-holder in a batch script

The name “label”is also a DOS command to creates, changes, or deletes the volume label of a disk.

The label must be at the beginning of a line with a colon.

It can be called via:

  • the goto command inside the script
  • the call command between two scripts

Example

@echo off

Goto myLabel
echo Do I see this ?

:: The label myLabel
:myLabel
echo No You will see this

Output:

No You will see this

Special

EOF

If Command Extensions are enabled, GOTO command now accepts a target label of :EOF which transfers control to the end of the current batch script file.

This is an easy way to exit a batch script file without defining a label. More see the call help.


Powered by ComboStrap