Sideway
output.to from Sideway
Draft for Information Only

Content

MS DOS Command: GOTO
 Description
 Syntax
 Parameters
 Remarks
  Valid values for label
  GOTO uses the first eight characters of each label
  Matching the label parameter with the label in the batch program
  Using GOTO for conditional operations
 Examples

MS DOS Command: GOTO

Reference from Microsoft MS-DOS cmd help

Description

Directs MS-DOS to a line in a batch program that is marked by a label you specify. You can use this command only in batch programs.

The GOTO command directs MS-DOS within a batch program to a line identified by a label. When MS-DOS finds the label, it processes the commands beginning on the next line.

Syntax

GOTO label

Parameters

label Specifies the line in a batch program to which MS-DOS should go.

Remarks

Valid values for label

The label parameter cannot include separators such as spaces, semicolons or equal signs.

GOTO uses the first eight characters of each label

The GOTO command uses only the first eight characters of a label. Therefore, the labels "hithere01" and "hithere02" are both equivalent to "hithere0".

Matching the label parameter with the label in the batch program

The label value you specify on the GOTO command line must match a label in the batch program. The label within the batch program must be preceded by a colon.

If your batch program does not contain the label that you specify, the batch program stops and MS-DOS displays the following message:

Label not found

MS-DOS recognizes a batch-program line beginning with a colon (:) as a label and does not process it as a command. If a line begins with a colon, MS-DOS ignores any commands on that line.

Using GOTO for conditional operations

GOTO is often used on the same command line with other commands to perform conditional operations. For more information about using GOTO for conditional operations, see the IF command.

Examples

The following batch program formats a disk in drive A as a system disk. If the operation is successful, the GOTO command directs MS-DOS to a label named "end".

  • echo off
  • format a: /s
  • if not errorlevel 1 goto end
  • echo An error occurred during formatting.
  • :end
  • echo Successfully formatted the disk in drive A.

©sideway

ID: 110700193 Last Updated: 7/28/2011 Revision: 0


Latest Updated LinksValid XHTML 1.0 Transitional Valid CSS!Nu Html Checker Firefox53 Chromena IExplorerna
IMAGE

Home 5

Business

Management

HBR 3

Information

Recreation

Hobbies 8

Culture

Chinese 1097

English 339

Reference 79

Computer

Hardware 249

Software

Application 213

Digitization 32

Latex 52

Manim 205

KB 1

Numeric 19

Programming

Web 289

Unicode 504

HTML 66

CSS 65

SVG 46

ASP.NET 270

OS 429

DeskTop 7

Python 72

Knowledge

Mathematics

Formulas 8

Algebra 84

Number Theory 206

Trigonometry 31

Geometry 34

Coordinate Geometry 2

Calculus 67

Complex Analysis 21

Engineering

Tables 8

Mechanical

Mechanics 1

Rigid Bodies

Statics 92

Dynamics 37

Fluid 5

Fluid Kinematics 5

Control

Process Control 1

Acoustics 19

FiniteElement 2

Natural Sciences

Matter 1

Electric 27

Biology 1

Geography 1


Copyright © 2000-2024 Sideway . All rights reserved Disclaimers last modified on 06 September 2019