Hello Master Jake here and today we’re going to be going over another tutorial with batch files, and this ones going to do with labels. It’s going to be a really short tutorial labels is not a very big topic at all. So I’m going to open up my notepad here and we’re going to go ahead and turn echo off and create a basic batch file. And labels is basically just sort of just labeling the code so you can return to it later. And I’ll show you an example here like we’ll do one called “Return to this”. We’ll just call the label that and now we’re going to put all our text under here for the label. We’ll make it echo high, now it’s going to pause and we’re going to use greater than null and look at my batch file spices tutorial to learn what the greater than null stuff does, but it basically just makes it invisible but that’s pretty much it.
And then we’re going to return to the return to this label, so to make a label you just put a color in it and then the label name. Now we’re going to return to the—and the return to the label you type “goto” as one word, space and the label name which is “Return to this”, and you don’t need the colon on it when you’re returning to one. So basically now we’re going to save real quick as a labels dot bat, make sure dot bat is on there, save as type change from text documents to all files.
Now I’m going to show you what it does so far. So all it does is says “Hi” and pauses, now when you press a key, it says “Hi” again, press the key it says “Hi”—I want to hold down the key to show you, and that will never stop until you exit out of the program. That’s because it’s pausing it, and once you press a key it’s going back to that label and it’s just returning to this spot and it’s starting at the first line of code from there on and going back down.
So we can even have stuff here like—we’ll name this Label A and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it g and then we’ll go to B, now we’re going to put text on it, this is like echo “My name is Jake” echo “How are you?”, pause greater than null. Now we’ll put the B label and just have this echo “You just skipped a ton of code” pause greater than null, exit. Now it’s going to start at Label A automatically because it will start at the first label. Once it gets to that point, it won’t have to go through it.
What’s it going to do is just—it’s going to echo “Hi’ on the screen and pause, but when you a key it’s going to go all the way down to B so it’s going to skip all this code because this code is not labeled. Well technically it’s under the A label, but it’s going to skip it because it goes to B on this line of code. It’ll skip all the way down to here and start there, so I’m going to show you what that does real quick.
It says “Hi” it pauses, “You just skipped a ton of code” so that’s what it did right there. Now we’ll take out, got to B and it’ll just keep down the line until it reaches a go to function. So it did everything and that’s pretty much how labels work, you can—on there and they want to—the code unless you use a go to function. So if there is no go to function, then it’ll just keep running down the line until it reaches one. And if there isn’t one, it’ll just run down until it exits. But if you put a go to function, and there’s somewhere it’ll go to one of them.
And I hope this tutorial was helpful for you and that’s just the basics of labels, there’s really nothing more I can tell you about them. That’s just all there is to it, you can add labels with variables and stuff to make some really cool programs and make sure you watch my other videos because I’m going to try to post a tutorial on all the important stuff and if you combine all the knowledge from all my videos, you can make some pretty massive awesome programs. So thanks for watching the video and I hope you enjoyed, remember to email me and go to my site at masterjake.co.nr and good luck creating your batch files.
Comments