batch parameters: everything after %1

前端 未结 7 1088
离开以前
离开以前 2021-02-03 18:44

Duplicate:

  • Is there a way to indicate the last n parameters in a batch file?
  • how to get batch file parameters from Nth position on?
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-03 19:10

    The following will work for args with ", =, ' ' (as compared to @MaxTruxa answer)

    echo %*
    set _all=%*
    call set _tail=%%_all:*%2=%%
    set _tail=%2%_tail%
    echo %_tail%
    

    Test

    > get_tail.cmd "first 1" --flag="other options" --verbose
    "first 1" --flag="other options" --verbose
    --flag="other options" --verbose
    

提交回复
热议问题