【发布时间】:2010-09-27 19:26:42
【问题描述】:
进一步How to Pass Command Line Parameters in batch file 如何通过准确指定其余参数来获得它们?我不想使用 SHIFT,因为我不知道可能有多少参数,并且如果可以的话,我想避免计算它们。
例如,给定这个批处理文件:
@echo off
set par1=%1
set par2=%2
set par3=%3
set therest=%???
echo the script is %0
echo Parameter 1 is %par1%
echo Parameter 2 is %par2%
echo Parameter 3 is %par3%
echo and the rest are %therest%
运行mybatch opt1 opt2 opt3 opt4 opt5 ...opt20 会产生:
the script is mybatch
Parameter 1 is opt1
Parameter 2 is opt2
Parameter 3 is opt3
and the rest are opt4 opt5 ...opt20
我知道%* 给出了所有参数,但我不希望没有前三个(例如)。
【问题讨论】:
标签: windows batch-file