arguments in windows batch

We can pass the arguments to batch file using below syntax.
myfile.bat arg1 arg2

To access these arguments from within batch file, you need to use %1, %2 and so on. Here is the simple batch file illustrating how to use arguments in batch file.
@echo off

echo batch file name is %0
echo first argument is %1

echo all arguments %*

rem below code will get total number of arguments
set argumentCounter=0
for %%a in (%*) do Set /A argumentCounter=argumentCounter+1

echo Total number of argument : %argumentCounter%               

Web development and Automation testing

solutions delivered!!