Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

[Tut] Full Batch tutorial. N00b Friendly[Tut]

Full batch tutorial
BY: Gh0st16

What is a batch file?
"A file containing a series of instructions to be carried out by the operating system" -en.wiktionary.org/wiki/batch_file (Google first link)

Will knowing the batch language make me a hacker?
Sadly no. It will make you smarter, more efficient on computers, and you can say your a Scripter (For ms-dos) But if you Really wanna be a hacker... Here is the secret. Spoiler (Click to View)

How do i make a batch file?
1. Open notepad.
2. Type the commands you would like your script to execute.
-2.(Continued) Type each command on a new line
3. Save file as (whateveryouwant).bat
4. Execute

Basic "Hello world" batch
To begin open notepad.
Type "@echo off" (Without Quotes)
[This is optional, but if you do not turn Echo off Then command prompt will show the commands unless you type @ before each command.]
Type "Title This is my batch" (Without quotes)
[This will make the title at the top say "This is my batch"]
Type "Color 0a" (without quotes)
[This will change the text color of command prompt to bright green]
Type "cls" (Without Quotes)
[This will clear the contents of the command prompt screen,]
Type Rem Gh0st16 is a beast
[This will not show up on the script. The only way to see this is by editing the batch]
Type "Echo." (no quotes)
[This will skip a line]
Now type "Echo Hello world" (Without Quotes)
[This will make the words "Hello world" appear on the screen.]
Then type "Pause"
[Will pause the script]
Next type "msg
Hello world" (Without Quotes)
[This will make a popup saying "Hello World"]
Type "PING 127.0.0.1 -n 5 >NUL" (without quotes)
[This will make your batch file wait 5 seconds before sending the next command]
Type "msg I will click an adf.ly link at the end of the tut."
[This will make a popup telling the future.🤫]
type "pause &Exit"
[This will pause the script until you press any key, then will exit."
Save as batch1.bat (When your saving, you may have to use the little dropdown box under where you name it and click SHOW: All files)
(**Open the file)

--For the skids who just want code code code... here is the code version of this.
Spoiler (Click to View)

More on Colors
Spoiler (Click to View)

Goto, Set, AND Variables!🤗
After you finished testing out your script... right click the file and click "Edit"
This should bring up a notepad box with all the commands you have typed.
We will Just add on to it to save time.

On the last line backspace the "pause &exit"
In its place type "Goto sexygh0st" (Just disregard all quotes in script)
[This command will take you to a different part of the script. It does NOT matter whether the spot is before or after the goto]
Then type "Msg
This command failed if you are seeing this"
[if this pops up, you suck at life. But it wont.]
Next type ":sexygh0st"
[This will be the spot that the goto command goes to. you can only rename this spot if you change it in the "goto" command also.]
Now type "Msg This command worked!"
[This will notify you that the command worked]
Type "Pause"
Now type "Echo you are logged in as %Username%"
[This will tell you the username you are logged in as]
Type "Echo It is %Time% on %Date%."
[This will tell you the time and date.]
now type "Set ghostissexy= Gh0st16 is a total beast!"
[This will set the variable ghostissexy equal to Gh0st16 is a total beast! Heres how it works (SET variable=string)]
Type "Pause"
Now type "msg
%ghostissexy%
[This should pop up a message box saying "Gh0st16 is a total beast!" Once a variable is set you just have to put it in % signs. (%variable%) and command should recognize it as whatever you set it equal to.]
Type "Echo %ghostissexy%"
[Guess what this does.]
then type "pause"
Save it and open. It should go on just like last time... up until where you changed it.
😉😉😉
Code version
Spoiler (Click to View)

The Set /p, Start, and call commands!👍
This time open up a new notepad.
Type in:
Code
@echo off
Title Batch 2
Color 0a
cls
Echo.
Now type "set /p name= What is your name? " (without quotes)
[This will set the variable name to whatever the user inputs]
Type "Echo Hello %name%"
type "pause"
Now type "Echo Press any key to CALL batch1"
pause>nul
[This will hide the "Press any key to continue..."]
now type "call batch1.bat"
[This will open a batch program inside a batch program! but make sure they are in the same folder/area when you save.]
type "pause"
Then "cls"
now type "Echo IT TOTALLY WORKED!"
then type "Echo Gh0st16 Is so sexy! I will be sure to thank him for the help!"
type "pause"
then type "msg * Opening notepad!"
Type "START notepad.exe"
[This will start whatever program you put after the start. {ex. Start cmd, start notepad, etc}][/code]
Save as batch2.bat
Open
Code version
Spoiler (Click to View)

The PING command!
Open notepad
Type:
Code
@echo off
title Pinger
color 0a
:start
cls
echo.
echo.
Now type "set /p png= Please enter the website you want to ping:"
Then type "ping %png% &goto start"
[What this does is not only does it send packets of data to a website... It will also tell you its ip address]

🤗Congratulations!🤗
You finished my tutorial!🤦‍♂
Remember: You can type in any command into command prompt without the string to get information about it. [eg. just type "ping"] Also, any command that works in command prompt, can work in a batch file. Sweet, isn't it?
Here are some references to help you out!
Batch Commands:
Spoiler (Click to View)
Color codesSpoiler (Click to View)
Popup maker CodeSpoiler (Click to View)

Reference links:
Note: All links are sent through adf.ly. Please click on at least one of them to support me. If you appreciated this tutorial so i can keep doing them. Thank you.
http://en.wikipedia.org/wiki/List_of_DOS_commands
http://www.easydos.com/dosindex.html
http://www.ahuka.com/?page_id=39
More: Spoiler (Click to View)

Credits go to...
Gh0st16 for writing this! (2.5 hours)
You who supported me by clicking a link and waiting 5 seconds to learn more!
Hack forums for helping me learn and understand.

If you want more tutorials covering more topics... Click on any of the links to show support!🤝
Nice Tutorial.

You forgot to add that you can learn all this from the "help" command.

But still it's a good tutorial.

Also you should stop mentioning to '+rep' you.
Hmm, never mind.. learn from your way of explanation by giving many resources sites
Thank you Dezinated :)

How can i improve it Haxced
Nice tutorial, but asking for rep is not allowed. I suggest you remove the bits you ask for rep.
Good tut.

You cound mention, if someone wants to get the IP address of a site, just enter the site without the protocol.
e.g.: ping hackforums.com

It is useful, is someone blocks certain sites by their names, therefore be aware this doen't if someone blocks the IP and URL (which can be resolved).
EDIT: You can get the IP, but not connect to it.
Wow amazing tutorial dude thanks it was a huge help
Thank you for the feedback! I updated the post with a ping section.

@Eтeяиıтч I think i Removed all of them. Sorry, didn't know it wasn't allowed.
(Dec 11, 2010 12:29 PM)SIM-587985 Wrote:  Thank you for the feedback! I updated the post with a ping section.

You should really note the three forms of commenting with batch files.
Also, you should show people the 'function' form of calling pseudo functions!
If nothing else, showing good design by using GOTO calls would be appreciated.

See here:
Code
@ECHO OFF

REM **
REM ** Program pings localhost for 5 seconds **
REM **

TITLE Gh0st16 is a sexy beast
COLOR 0A
GOTO MAIN

:MAIN
ECHO To start the program:
PAUSE
ECHO.
GOTO PING

:PING
ECHO Pinging localhost for 5 seconds...
ECHO Press CTRL + C anytime to cancel
PING 127.0.0.1 -n 5 >NUL
GOTO END

:END
PAUSE

When you create more useful, elaborate batch-file scripts, structuring it helps a lot! 😧
Is there any such thing as a woman of honor, and sincerity?

https://www.PutItOnMute.com/

4K HDR, WDR time-lapsed truck driving videos!
Thanks this was helpfull especially the three lists at the end.🎉
interesting,
but i confused, :D
What about?
Spoiler (Click to View)
Trying to help everyone
Thanks everyone!
B.U.M.P
Bump
Up
My
Post
Nice tutorial, I know a little more now :)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by Robert RougeSep 24, 2026 10:02 AM 4 215 Sep 24, 2026 10:02 AM
Last Post: Anonynuk
[Shell] by ɩᴄᴀʀᴜȿ ᴌוᴠᴇѕ™Sep 24, 2026 09:38 AM 4 81 Sep 24, 2026 09:38 AM
Last Post: Anonynuk
[Shell] by fisica638Oct 30, 2019 11:05 AM 1 535 Oct 30, 2019 11:05 AM
Last Post: Hackoo