Windows Script-shift command

Source: Internet
Author: User

Shift command details
Shift is to move all parameters one by one.
Shift/2 is to move all the following parameters forward from the first parameter, but it does not affect the previous parameter position (I .e., it does not affect 1)
Shift/3 is to move all the following parameters forward from the first parameter, but it does not affect the previous parameter position (I .e., it does not affect 1, 2)
And so on ...... ......

Example 1 shift. bat

Batch code
  1. @ Echo off
  2. Parameters before echo shift: % 1% 2% 3% 5
  3. Shift/2
  4. Echo parameters after second displacement: % 1% 2% 3% 5
  5. Shift
  6. Echo parameter after another shift: % 1% 2% 3% 4% 5
  7. Pause
@ Echo offecho parameters before shift: % 1% 2% 3% 4% 5 shift/2 Echo parameters after second shift: % 1% 2% 3% 4% 5 shiftecho parameters after another shift: % 1% 2% 3% 5 pause

Example 2 call shift. Callshift. bat

Batch code
  1. @ Echo off
  2. Call shift. Bat 1 2 3 4 5
@echo offcall shift.bat 1 2 3 4 5

Double-click callshift. bat and the running result is:

Batch code
  1. Parameters before shift: 1 2 3 4 5
  2. Parameters after the second displacement: 1 3 4 5
  3. Parameters after another shift: 3 4 5

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.