How to pass more than 9 parameters to batch file

后端 未结 11 1469
花落未央
花落未央 2020-12-17 18:08

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?

11条回答
  •  执念已碎
    2020-12-17 18:52

    :: set PARAMn and count parameters
    SET /a paramcount=1
    :paramloop
    SET "param%paramcount%=%~1"
    IF DEFINED param%paramcount% SET /a paramcount+=1&shift&GOTO paramloop
    SET /a paramcount -=1
    

    This routine should set param1..paramn for you, with a count.

    Unfortunately, your posted code appears indecipherable, so actually using the values - that's up to you.

提交回复
热议问题