Command-line arguments is part of Short Circuit's Console Program Basics selection.
Scripted main
See also Program name.

For parsing command line arguments intelligently, see Parsing command-line arguments.

Example command line:

myprogram -c "alpha beta" -h "gamma"

@echo off
setlocal enabledelayedexpansion
 
set Count=0
:loop
if not "%1"=="" (
   set /a count+=1
   set parameter[!count!]=%1
   shift
   goto loop
)
 
for /l %%a in (1,1,%count%) do (
   echo !parameter[%%a]!
)