1.

Solve : To count Command line arguments (Paramaters) in .Bat file.?

Answer» HI all!!!!!!!!!

I am SENDING some parameters to a .bat file through command line. I want the count of that parameters means how many parameters I am passing. If i will enter less than the sufficient then the message should GET prompted to the user.

Can anyone please give me the solution.



thanks.You can check if a parameter is a null string

For example if you are expecting four parameters...

if "%1"=="" (
echo parameter 1 is missing
goto end
)

if "%2"=="" (
echo parameter 2 is missing
goto end
)

if "%3"=="" (
echo parameter 3 is missing
goto end
)

if "%4"=="" (
echo parameter 4 is missing
goto end
)

REM if you get here 4 parameters were passed

REM HERE IS YOUR CODE

:end
Thanks !!!!!!!!!!!!!!

It's working fine for me.

Thanks again.


Discussion

No Comment Found