Guides:Shells/COMMAND.COM-CMD.EXE/DOS Commands/GOTO

From CoderGuide

Jump to: navigation, search

Return to: Guides:Shells/COMMAND.COM-CMD.EXE/DOS Commands

GOTO

Format:

GOTO label

Batch file example

@echo off
echo hello!
goto skip
echo this line skipped
:skip
echo Bye!

The GOTO statement is only usefun in batch files (.BAT files). They are used for simple program control. They can even be used to make interactive batch files when used with the IF statement and third part utilities that grab keystokes and return an exit code based on the key pressed.

As DOS is shipped, batch files can not be made interactive. However, every version of DOS since 3.0 has included BASIC or QBASIC. Windows 98 and later has it's own scripting language. Both BASIC and Windows scripts can be used to make interactive utilities.

Personal tools