Header Banner
Null Byte Logo
Null Byte
wonderhowto.mark.png
Cyber Weapons Lab Forum Metasploit Basics Facebook Hacks Password Cracking Top Wi-Fi Adapters Wi-Fi Hacking Linux Basics Mr. Robot Hacks Hack Like a Pro Forensics Recon Social Engineering Networking Basics Antivirus Evasion Spy Tactics MitM Advice from a Hacker

How to Write Batch!

Feb 17, 2016 03:53 PM
"How to Write Batch!" cover image

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

How to Write Batch!

@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!

Code snippet displaying a terminal output with the text "hello null bytes".

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!

Command line interface with the text "Press any key to continue..." displayed.

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!

Code snippet demonstrating a simple command-line interface with instructions and commands.

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?

You already know how to use your phone. With Gadget Hacks' newsletter, we'll show you how to master it. Each week, we explore features, hidden tools, and advanced settings that give you more control over iOS and Android than most users even know exists.

Sign up for Gadget Hacks Weekly and start unlocking your phone's full potential.

Related Articles

Comments

No Comments Exist

Be the first, drop a comment!