Learning CMD Commands
Learning CMD Commands
Read me
batch
file
batc
file
Programming
batch
batch
hacker
ac
C++
t t
python
Web
Web
ac e
php
t t
theory
:D
file
C:\a.txt
D:\
backb0neb00t3r
cmd
a
C:\folder\green.jpg
Copy C:\a.txt D:
copy
C:\folder\green.jpg D:
batc
e
temp
recent
batc
batc
a
windows
ce t
system
:D
Batch file
if, for
ec
, a e, e ,
t , ca ,
batc
cmd
if
For
:D
Echo command
c
Hello World!
Notepad
program.bat
Hello
world!
@echo off
echo Hello World!
Pause
backb0neb00t3r
ec
@echo
off
C:\Users\
@echo off
Pause command
a e
pause
Hello World!
a y
ey t
:D
a e
Goto command
Goto
goto
@echo off
echo hi
goto a
echo hey
backb0neb00t3r
echo hello
:a
echo Hello World
pause
echo hi
goto a
a
:a
Rem command
rem
comment(
@echo off
echo hi
rem echo hi
echo hey
echo hello
pause
backb0neb00t3r
Hi
rem
e
Call command
Call
word
batch file
ca
notepad
name.txt
Batc
@echo off
echo hi
pause
call name.txt
name.txt
call
(
D:
@echo off
echo hi
call D:\name.txt
pause
backb0neb00t3r
:D
Cmd
windows key + R
cmd
run box
cmd
:D
File management
D:\name.txt
note
Cmd
copy D:\name.txt D:\note
1
file(s)
copied
note
Copy
cut
move
Paste
cut-
paste
D:\note\name.txt
..
1 file(s) moved
e a e
C:\name.txt
rename.txt
e t
rem
move
rename.txt
name.txt
file(s)
moved
Na e txt
copy C:\name.txt C:\koko.txt
Koko.txt
name.txt
koko.txt
del C:\koko.txt
backb0neb00t3r
1 file(s) copied
Changing path
e a e
username
Users
username
D:
D:
D:
D:
dir
<DIR>
< IR>
(
)
love
cd love
D:\love>
D:\love
dir
backb0neb00t3r
cd ..
cd
cd ..
x
linux
:D
D:\general\ebook\tutorials\
cd D:\general\ebook\tutorials\
dir
backb0neb00t3r
10
dir /p
C:\Windows\System32
/p
Creating folder
cmd
D:
te
mkdir booter
booter
dir
mkdir
linux
( matrix folders )
Matrix folders
Notepad
.bat
@echo off
backb0neb00t3r
11
:a
mkdir %random%
goto a
pause
:D
%a
backb0neb00t3r
%
Learning cmd commands
12
random name
mkdir
%random%
random
name
Cmd colour
cmd
color 9A
cmd
BLACK
GRAY
BLUE
LIGHT BLUE
GREEN
LIGHT GREEN
AQUA
LIGHT AQUA
RED
LIGHT RED
PURPLE
LIGHT PURPLE
YELLOW
LIGHT YELLOW
WHITE
LIGHT WHITE
color
backb0neb00t3r
13
color 01
color
cmd
cmd
right click
properties
:D
Title
Cmd
C:\W
booter
title booter
booter
Clear screen
cmd
cls
Prompt design
Prompt
C:\Users\username>
Prompt
prompt
love
Prompt
D:\love>
backb0neb00t3r
prompt
14
booter>
prompt booter $g
<
<
b
prompt booter $l
$
t
te
$g
$A & (Ampersand)
$B | (pipe)
$C ( (Left parenthesis)
$D Current date
$E Escape code (ASCII code 27)
$F ) (Right parenthesis)
$G > (greater-than sign)
$H Backspace (erases previous cha
$L < (less-than sign)
$N Current drive
$P Current drive and path
$Q = (equal sign)
$S (space)
$T Current time
$V Windows XP version number
$_ Carriage return and linefeed
$$ $ (dollar sign)
backb0neb00t3r
15
Previous commands
(up arrow)
new
enter
date
enter the new date
date /t
time /t
time
backb0neb00t3r
16
Autocomplete
date
date
date
a t
2.21.2014
echo 2.21.2014 | date
shift
ec
c
T
Message
w
batch
batch file
backb0neb00t3r
17
shutdown /s
shutdown /a
shutdown /s /t 1800
/t
1800
/t 00
L
shutdown /l
L
backb0neb00t3r
e ta t
18
shutdown /r
e ta t
batch file
cmd
Run commands
c
notepad
cmd
run
notepad program
notepad
run
registry editor
registry editor
c
cmd
Command prompt
notepad
Notepad
regedit
Registry editor
gpedit.msc
msconfig
System configuration
services.msc
Windows services
control
Control panel
devmgmt.msc
Device manager
dfrg.msc
Disk Defragmenter
Cleanmgr
Disk cleanup
diskmgmt.msc
Disk management
mspaint
Paint
explorer
Windows explorer
calc
calculator
backb0neb00t3r
regedit
19
run
net users
User
accounts
for
\\computername
Administratr
Guest
built-in
password
net user
backb0neb00t3r
20
/a
net users
(type)
administrator
t ta
standard
user
ett
A
standard
t ator account
user
administrator
administrator
standard user
net localgroup administrators booter /delete
administrtors group
information
net user booter
booter
at
ex
( password
backb0neb00t3r
setting
Learning cmd commands
21
standard
user
administrators
administrator
backb0neb00t3r
22
Environment variables
Environment variables
operation
system
C:\Windows
environment variable
%systemroot%
cd %systemroot%
C:\Windows
e t a ab e
cd C:\Users\%username%
% e a e%
environment variable
e t a ab e
OS
%%
environment variables
e
e
e t
a ab e
e t a ab e
%username%
Username
%userprofile%
%computername%
Computer name
%RANDOM%
%systemroot%
Windows directory
%time%
Display time
backb0neb00t3r
23
%date%
Display date
%temp%
Temp foleder
System information
Cmd
y te
M t eb a ,
motherboard
model
system
M t eb a
motherboard
driver
cd
driver
t eb a
Redirect output
y te
text file
y te
system in
backb0neb00t3r
text file
at
24
systeminfo
..
.
Exit
exit
Task
Taskmanager
ce
taskmanager
cmd
ce
tasklist
ce
image name, pid
ce
at
ce
process
pid
Pid
728
taskkill /pid 728
ce
backb0neb00t3r
25
image
name
taskkill /im notepad.exe
te a exe
Process
Image name
Naming partition
label C: OS
C:
OS
D:
E:
Creating variables
a ab e
Variable
environment variables
variable
variable
set booter=male
variable
echo %booter%
ae
backb0neb00t3r
a ab e
Learning cmd commands
26
%%
booter
male
variable
Ma e
a ab e
set a=male
a
variable
variable
user
variable
@echo off
set /p pass= echo type your password:
cls
echo Your password is %pass%.
Pause
.bat
batch file
et /
pass
user
input
variable
a =
....
27
Input
pass
password
is
password
variable
echo Your
%pass%
%pass%
c
variable
clear screen
e t
set
echo
a ab e
a ab e
cmd
variable
variable
If statement
I
If
conditional statement
C:\Windows\System32\mgy.exe
If
@echo off
if exist C:\Windows\System32\mgy.exe (
del C:\Windows\System32\mgy.exe
echo MGY.exe was found.So, I deleted this.It's a virus.
) else (
echo MGY.exe was'nt found.It' OK! :D
backb0neb00t3r
28
)
pause
If exist
del
C:\....\mgy.exe
C:\....\mgy.exe
echo
else
If statement
Mgy.exe
.. If
exi t
y exe
M y exe
e e
. :D
if exist
if note exist
If
If
@echo off
:start
echo Welcome to my program
set /p pass= echo Please tell me your dirth-year to use my program:
if %pass% leq 1995 (
goto old
) else (
goto young
)
backb0neb00t3r
29
:young
echo You can't use my program
pause
cls
goto start
:old
cls
echo You can use my program.
pause
goto :program
:program
cls
echo We are the world
pause
echo We are the children
pause
echo Time to stop my program ! Have a nice day !
pause
exit
If
backb0neb00t3r
I % a % eq 1995
30
1995
1995
Le
t a
eq a
equ
Equal
neq
Not equal
lss
Less than
leq
gtr
Greater than
geq
File attributes
attributes
( attributes )
Hidden
attribute,
read-only attribute,
system file attribute,
attribute
archive
attrib
e , y te
att b
hidden
backb0neb00t3r
31
e att b
\hehe.txt
att b
attrib D:\hehe.txt
A
D:\hehe.txt
A attrib
system
s read-only
ac
hidden
hidden
attrib +h D:\hehe.txt
e e txt
attrib +h hehe.txt
hidden
attrib +h +r +s D:\hehe.txt
hidden system read-only
backb0neb00t3r
32
attrib h r s D:\hehe.txt
att b
Deleting files
Del
attrib
att b
e
h s r
del
hsr
hehe.txt
cmd
del /p D:\hehe.txt
Delete ( y / n ) ?
y
backb0neb00t3r
ye
\My folder\*
33
my folder
/p
yes
yes no
/q
e /q
Quiet
\My folder\*
\My folder\*
My
folder
* /q /
e /q
.txt
\My folder\*.exe
.exe
e /q
\My folder\b * *
bo
exe
folder\bo????.txt
backb0neb00t3r
txt
bo
bo
\My
txt
34
del
\My
My
My
e
e
folder
/s
\My folde
/q
hidden
e
/a
backb0neb00t3r
\My
35
Suggestion
cmd
batch file
del /?
e
system
learning
learn
Written by backb0neb00t3r(MHU)
backb0neb00t3r