How to receive multiple input parameters in a batch command
Code
In batch command, for a natural number , %n
refers to the th parameter, and the array of all parameters is represented as %*
1. For example:
Let’s assume there is a batch file named multi.bat
in the directory as shown above.
@echo off
echo %%1: %1
echo %%3: %3
echo %%*: %*
pause
The result of executing multi.bat
by drag-and-dropping the three folders A
, B
, and C
is as follows:
Environment
- Windows11
- Linux Mint 21.2 Cinnamon v5.8.4