Dos - Label (Line)

> Procedural Languages > Dos (Win32 Shell Scripting) and Utilities

1 - 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
Advertising

3 - 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

3.1 - Special

3.1.1 - 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.

lang/dos/label_line.txt · Last modified: 2018/12/19 21:25 by gerardnico