Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 221835
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:04:15+00:00 2026-05-11T19:04:15+00:00

Duplicate: Is there a way to indicate the last n parameters in a batch

  • 0

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?

Clarification: I knew of the looping approach – this worked even before Command Extensions; I was hoping for something fun and undocumented like %~*1 or whatever – just like those documented at http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/percent.mspx?mfr=true.


In a Windows batch file (with the so called “Command Extensions” on), %1 is the first argument, %2 is the second, etc. %* is all arguments concatenated.

My question: is there a way to get everything AFTER %2, for example?

I couldn’t find such a thing, and it would be helpful for something I’m working on.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T19:04:15+00:00Added an answer on May 11, 2026 at 7:04 pm

    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!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Duplicate: Is there a way to instantiate objects from a string holding their class
Possible Duplicate: Is there any way to determine text direction from CultureInfo in asp.net?
Is there a way to remove duplicate (key-value) pairs from NSDictionary ? EDIT: My
Possible Duplicate: Is there a clean way to prevent windows.h from creating a near
Possible Duplicate: Is there an easy way in .NET to get “st”, “nd”, “rd”
Possible Duplicate: Is there a way to select nth column in a SELECT clause
Possible Duplicate: emacs lisp, how to get buffer major mode? Is there a way
Possible Duplicate: Is there a way to get an user's email ID after verifying
Possible Duplicate: Is there a portable way to get the current username in Python?
Possible Duplicate: Is there a way to have content from an IFRAME overflow onto

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.