How can I pass more than nine parameters to bach file.
I tried another SO question
How do you utilize more than 9 arguments when calling a label in a CMD batch-script?
Use %*. Command Line arguments (Parameters)
People who looking for how to passthrough any number of params to an executable:
@ECHO OFF
SET "EXECUTABLE=C:\PATH\TO\MY\EXECUTABLE.EXE"
CALL %EXECUTABLE% %*
Answering the question (openurl.bat):
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET URL=
SET /A BASECONCATENATED=0
FOR %%A IN (%*) DO (
SET PARAM=%%A
SET PARAM=!PARAM:"=!
IF !BASECONCATENATED! EQU 0 (
SET "URL=!URL!!PARAM!^?"
SET /A BASECONCATENATED=1
) ELSE (
SET "URL=!URL!!PARAM!^&"
)
)
SET URL=!URL:~0,-1!
CALL "%SYSTEMDRIVE%\Program Files\Internet Explorer\iexplore.exe" "!URL!"
REM EXAMPLE cmd.exe "openurl.bat" http://www.example.com/addPerson.php "firstName=Juan" "lastName=Cerezo" "hobby1=Coding" "hobby2=Learning" "hobby3=Play Videogames"