How to Write Batch!

Feb 17, 2016 03:53 PM
635912912336556231.jpg

Right, So i've been asking alot of questions here on Null-Byte and everyone has been really helpful to me.

So i thought i'd try and give back with one of the first Programing Lang i started with. I know many people of Null-Byte are most likely past the points i am going to talk about but i don't wana skip ahead and then people don't understand the basics!

Right! let's jump into it! Batch is basicly CMD or as some of my older people know it as DOS it's a command line:

So our scripts are basicly CMD/DOS

635912912336556231.jpg

@Echo off

Let's start off with @Echo off

This command hides all the unwanted "Text" in the console

9 times out of 10 you'll start your script off with that unless you are debugging your script. But we will get into that later.

Echo

echo is print if you've played around with any other programing langue

so what ever you type after "Echo" will be printed to the CMD window!

635912915154229632.jpg

you can start a cmd window by pressing windowskey+R then typing CMD.

Pointers

now i call theese points but i could be wrong!

Basicly these allow you to jump around in your code

You declare a point with :

anything after ":" will be the point name these are simaller to vars! if you don't know what vars are don't worry about it i'll explain in a later tut. Just remeber that you can not have the same name on two pointers for example

:home

Random Code

:home

Random Code

If you are wanting to jump to a pointer it' simple goto PointerName.

Pause

The pause command is your best freind when it comes to debugging in short it stops the code and waits for user input!

635912921409181498.jpg

This will prevent your script from closing instantly!

Ending off!

Let's put all the stuff we have learnt and make a basic script real quickly!

635912922799386460.jpg

Copy that into a notepad of your own and save it as Anything.bat !

ofcourse don't copy the arrows those just comment!

I guess that's it! First lesson and First post on Nul Byte.

Sorry if i am starting really slow. I'll get to more complex stuff asap just hang in there!

Thanks for reading hope it helped in some werid way?

Comments

No Comments Exist

Be the first, drop a comment!