batch parameters: everything after %1

前端 未结 7 1193
离开以前
离开以前 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 18:47

    I am not sure if there is a direct command but you can always use a simple loop and shift to get the result in a variable. Something like:

    @echo off
    set RESTVAR=
    shift
    :loop1
    if "%1"=="" goto after_loop
    set RESTVAR=%RESTVAR% %1
    shift
    goto loop1
    
    :after_loop
    echo %RESTVAR%
    
    

    Let me know if it helps!

提交回复
热议问题