I\'d like to make sure that when calling my batch, no more than 2 parameters are passed.
Is there an easy way to check that, or do I have to call SHIFT as many times as
Here is my small example for gathering and parsing a list of arguments and passing to external command:
@echo off
setlocal enabledelayedexpansion
if %1. EQU . (
echo %~0 [-t NUM] FILE [FILE...]
goto end
)
:args_loop
if "%~1" EQU "-t" (
set arg_t=%1
set arg_t_val=%2
shift
) else (
set files=!files! %1
)
shift
if %1. NEQ . goto args_loop
:args_loop_end
x:\path\to\external.exe %arg_t% %arg_t_val% %files%
:end