Dos - Label (Line)

Card Puncher Data Processing


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


@echo off

Goto myLabel
echo Do I see this ?

:: The label myLabel
echo No You will see this


No You will see this



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.

Discover More
Card Puncher Data Processing
DOS - Special Characters

This article tries to list all special characters and their meanings. Character Description Articles | pipeline > stdout < stdin 2> stderr >> append & duplicate handle or control...
Card Puncher Data Processing
Dos - Call (Subroutine, function)

The command “call” calls: one batch script passing the (variable|execution) context (the environment variable) a label (ie function) START where: argument The CALL command now accepts...
Card Puncher Data Processing
Dos - Control Flow

The flow in DOS can be controlled via: Labels that can be called with the goto (inside the script) or call (outside the script) FOR runs a specified command for each file in a set of files
Card Puncher Data Processing
Dos - Goto Command

To get more documentation the Goto command, type on a console: The goto command redirects the instruction flow to a labeled line in a batch program. Output:
Card Puncher Data Processing
How to create a DOS function ? (known also as a subroutine)

functions in dos are: created and named with a label called with the CALL command creating a subroutine exited with the goto command where: arguments are the argument of the subroutine goto...

Share this page:
Follow us:
Task Runner