Ch-4 about batch file programming What is parameter

Опубликовано: 03 Июнь 2026
на канале: Some ordinary Programmers
410
15

Hy everyone this me swetanshu and you are watching some ordinary programmers
in this video i will tell about parameters and how they really works so
watch the video and learn so you can move onto the hacking. before i have
discussed about batch file programming watch ch-2 and ch-3 link in discription
learnh it and it will help you in batch trust me this will make you to learn
hacking easily
If you dont understand hindi language read about it and learn

Translation in English :
Parameters: Giving Information to Batch Programs
To make batch programs really intelligent you need to be able to provide
them
with parameters which are nothing but additional valuable information
which is
needed to ensure that the bath program can work efficiently and
flexibly.
To understand how parameters work, look at the following script:
@ECHO OFF
ECHO First Parameter is %1
ECHO Second Parameter is %2
ECHO Third Parameter is %3
The script seems to be echoing(printing) messages on the screen, but
what do the
strange symbols %1 , % 2 etc stand for? To find out what the strange
symbols
stand for save the above script and go to DOS and execute this script
by passing
the below parameters:
C:\windows batch_file_name abc def ghi
This batch file produces the following result:
C:\windows batch_file_name abc def ghi
First Parameter is abc
Second Parameter is def
Third Parameter is ghi
The first line in the output is produced by the code line:
ECHO First Parameter is %1
Basically what happens is that when DOS encounters the %1 symbol, it
examines
the original command used to execute the bath program and look for the
first
word (argument) after the batch filename and then assigns %1 the value
of that
word. So one can say that in the ECHO statement %1 is replaced with
the value of
the first argument. In the above example the first word after the
batch file name
is abc, therefore %1 is assigned the value of this word.
The %2 symbol too works in the similar way, the only difference being
that
instead of the first argument, DOS assigns it the value of the second
argument,
def. Now all these symbols, %1, %2 are called replaceable parameters.
Actually
what happens is that %1 is not assigned the value of the first argument,
but
in fact it is replaced by the value of the first argument.
If the batch file command has more parameters than what the batch
file is
looking for, then the extras are ignored. For example, if while executing
a batch
file program , we pass four arguments, but the batch file program
requires only
3 parameters, then the fourth parameter is ignored.
To understand the practical usage of parameters, let's take up a real
life
example. Now the following script requires the user to enter the name
of the
files to be deleted and the folder in which they are located.
@ECHO OFF
CD\
CD %1
DEL %2
This script can be called from the DOS prompt in the following way:
C:\windows batch_file_name windows\temp *.tmp
In a single script we cannot use more that nine replaceable parameters.
This
means that a particular batch file will have replaceable parameters from
%1 to
%9.Infact there is a tenth replaceable parameter, the %0 parameter.
The %0
parameter contains the name of the batch file itself.
************
HACKING TRUTH: Say you want to execute a batch file and once the
procedure of
execution is complete, want to leave DOS and return to Windows, what
do you do?
The EXIT command can be used in such situations. So simply end your
batch file
with the EXIT command.
EXIT
************
SHIFT: Infinite Parameters
Sometimes your batch file program may need to use more than nine
parameters at a
time.Actually you would never need to, but at least you are sure you
can handle
it if you need to.To see how the SHIFT command works, look at the
following
snippet of code:
@ECHO OFF
ECHO The first Parameter is %1
ECHO.
SHIFT
ECHO The Second Parameter is %1
ECHO.
SHIFT
ECHO The Second Parameter is %1
Now execute this batch file from DOS and see what happens.
C:\windows batch_file_name abc def ghi
The first Parameter is abc
The Second Parameter is def
The Second Parameter is ghi
How does it work? Well, each SHIFT command shuffles the parameters
down one
position.