Goto Command In Windows Server 2008

This article explains Goto command in Windows Server 2008 operating system.
  • 1392

Introduction

Goto command applies to all versions of Windows. Goto command is used to transfer control from one part of a batch file to another. Cmd  directs cmd.exe to a labeled line in a batch program. Goto directs command processing to a line that is identified by a label. Label is used to define the transfer point in the batch file. Basic syntax for using Goto command is given below.

Syntax

goto <Label>

In above syntax

Parameter Description
<Label> Specifies text string used in batch program as a label.

Example

Formats a disk in drive A as a system disk. If no error occured, the goto command directs processing to the :end label.

echo off
format a: /s
if not errorlevel 1 goto end
echo Error occurred .
:end
echo End of batch program.

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2019 DotNetHeaven. All rights reserved.