Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of passing more than 10 parameters in bat

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you the "sample analysis of passing more than 10 parameters in bat". The content is simple and clear. I hope it can help you solve your doubts. Let the editor lead you to study and study the "sample analysis of passing more than 10 parameters in bat".

The parameter that can be referenced in the batch file is% 0% 9, and% 0 refers to the batch file itself, or an external command;% 1% 9 is a batch parameter, also known as a formal parameter; and if the arguments of replacing formal parameters exceed the values specified in the batch file (9) and want to apply these arguments in the batch file, the shift command can help you!

Shift command: changing the location of replaceable parameters in a batch file

C code

Shift [/ n]

The value of shift [/ n] n is [0Magne8] and is an integer; [/ n] is an optional parameter, and when given a value to n, it means that the command starts to shift from the nth parameter; when the value given by n is 0Magne1 or shift without any command options, it means that the replacement parameter in the batch file moves one position to the left, and the subsequent replacement parameters are filled one after another until the replaceable parameter is empty.

Eg: create batch file d:\ test.bat;C code

The code is as follows:

@ echo off

Cls

Echo 1 2 3 4 5 6 7 8 9

Shift / 0

Echo 1 2 3 4 5 6 7 8 9

Shift / 1

Echo 1 2 3 4 5 6 7 8 9

Shift / 2

Echo 1 2 3 4 5 6 7 8 9

Shift / 3

Echo 1 2 3 4 5 6 7 8 9

Shift / 4

Echo 1 2 3 4 5 6 7 8 9

Shift / 5

Echo 1 2 3 4 5 6 7 8 9

Shift / 6

Echo 1 2 3 4 5 6 7 8 9

Shift / 7

Echo 1 2 3 4 5 6 7 8 9

Shift / 8

Echo 1 2 3 4 5 6 7 8 9

Pause 1 > nul

@ echo offclsecho 1% 2% 3% 4% 5% 7% 8% 9shift / 0echo% 1% 3% 4% 5% 6% 8% 9shift / 1echo% 1% 2% 3% 4% 5% 6% 7% 8% 9shift / 2echo% 1% 3% 4% 5% 7% 8% 9shift / 3echo% 1% 3% 4% 5% 7% 8% 9shift / 4echo% 1% 2% 3% 4% 5% 6% 7% 8% 8% 8% 9shift / 5echo 1% 2% 3% 4% 5% 6% 8% 9shift / 6echo% 1% 2% 3% 4% 5% 6% 7% 8% 9shift / 7echo% 1% 2% 3% 4% 5% 6% 8% 9shift / 8echo 1% 2% 3% 4% 5% 7% 8% 9pause 1 > nul

Then enter test 1234.17 at the command prompt d:\ to display the execution result, and you will know the rule! C code

D:\ > test 12 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17

1 2 3 4 5 6 7 8 9

2 3 4 5 6 7 8 9 10

3 4 5 6 7 8 9 10 11

3 5 6 7 8 9 10 11 12

3 5 7 8 9 10 11 12 13

3 5 7 9 10 11 12 13 14

3 5 7 9 11 12 13 14 15

3 5 7 9 11 13 14 15 16

3 5 7 9 11 13 15 16 17

3 5 7 9 11 13 15 17

The above is all the content of the article "sample Analysis of passing more than 10 parameters in bat". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report