3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Advanced Batch

Step 8GOTO Command

GOTO Command
The GOTO Command. It does exactly what it says; it GOes TO a label in the batch file script.

To use this command, you must first have a label in place. Labels look like this:
:Label1
It's simply a colon before a non-spaced series of letters and/or numbers.

The GOTO command is structured like this:
GOTO Label1
It's That Easy!
Come to think of it, I'm not really sure why I didn't put this in the Slightly Advanced Batch.

In any case, this command can be used to repeat a batch file by simply GOTO a label that executes the GOTO command again.

@ECHO OFF:RepeatMeECHO This will be repeated unless you hit "CTRL-C"GOTO RepeatMe
The batch file speaks the truth, by the way. CTRL-C is the universal Pause and Prompt for Termination. CTRL-S is simply Pause. But Closing the window works just as well.

The GOTO can skip, or reorder your code as well.
GOTO TurnEOffGOTO MultipleGotoECHO This ECHO is going to be skipped.:MultipleGotoGOTO 3:ENDPAUSEEXIT:1ECHO The EndGOTO END:3ECHO This will be displayed firstGOTO 2:TurnEOff@ECHO OFFGOTO MultipleGoto:2ECHO This is second, even though it's last in the code.GOTO 1
The above code was structured confusingly on purpose to emphasize the GOTO's ability to jump around in the code.
« Previous StepDownload PDFView All StepsNext Step »
1 comment
Jul 16, 2010. 11:55 AMteh_pwnage says:
@ECHO OFF color 29 :hmm? Echo Chose the right number or get PWNED! echo. echo. set /p lol=Choose or ELSE!!!))) if %lol%== 8 good... if not %lol%== 8 goto pwn :pwn start http://www.youtube.com/watch?v=oHg5SJYRHA0&feature=related/ exit :good... echo You got lucky... pause >nul

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
22
Followers
5
Author:Neodudeman