![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-18 12:18 |
47,814 topics / 349,908 posts / today 1 new / 48,259 members |
| DOS疑难解答 & 问题讨论 (解答室) » Please clarify the specific content related to the "FOR statement / the secret" you want to express, as the current description is too vague. For example, is it about the syntax of the FOR statement in a certain programming language and the meaning of the "/" in it, or something else? Please provide more detailed information. |
| Printable Version 3,772 / 25 |
| Floor1 doyoukissme | Posted 2006-10-24 07:22 |
| 新手上路 Posts 2 Credits 6 | |
|
I'm a student who has just started learning DOS language.
I'm very interested when learning. But when I learned the FOR statement, I had a problem. That is, what do the three parameters /R, /L, and /F mean respectively? Are there any other parameters? I checked some materials for this problem and only found simple explanations. I hope an expert can tell me a more detailed explanation. Thanks here again.:D |
|
| Floor2 fastslz | Posted 2006-10-24 07:35 |
| 铂金会员 Posts 2,315 Credits 5,493 From 上海 | |
|
FOR /? is all its help! But the FOR command is not easy to master哦. Flexibility in application and thinking are very important. Search more examples on the forum to have a look~
|
|
| Floor3 doyoukissme | Posted 2006-10-24 08:07 |
| 新手上路 Posts 2 Credits 6 | |
Originally posted by fastslz at 2006-10-24 07:35: FOR /? I have seen it come over`````But only FOR /R and FOR /F explanation````` That /L are I see in the example```` I don't know other / behind the parameters of FOR`````In this case, flexible application do not talk about````` |
|
| Floor4 namejm | Posted 2006-10-24 08:30 |
| 荣誉版主 Posts 1,737 Credits 5,226 From 成都 | |
|
Please click here: The Most Powerful DOS Command – for
[ Last edited by namejm on 2006-10-24 at 09:36 AM ] |
|
| Floor5 jinstar211 | Posted 2006-10-24 08:34 |
| 新手上路 Posts 7 Credits 14 | |
|
I know nothing, just come here to learn~~~
|
|
| Floor6 vkill | Posted 2006-10-24 09:06 |
| 金牌会员 Posts 1,744 Credits 4,103 From 甘肃.临泽 | |
|
The help for for is also very good, ah
|
|
| Floor7 lxmxn | Posted 2006-10-24 10:44 |
| 版主 Posts 4,938 Credits 11,386 | |
|
Actually, the /L parameter is in the help for for. It's just that for novice friends, the explanation is relatively obscure. If you search in the forum, there are many usages of the for command. Personally, I feel that to learn anything, you first need to learn how to study. Once you master a good learning method, you can learn everything smoothly. That's the most important thing. |
|
| Floor8 flyskygen | Posted 2006-10-25 04:27 |
| 新手上路 Posts 1 Credits 4 From 湖北省襄樊市 | |
|
I don't understand very well either: for /l is a loop...
For example: for /l %i in (1,1,1000) echo %i will display: 1 to 1000 1 is the start value, the second 1 is the increase value, if it is -1 it is the decrease value, 1000 is the end value. I don't know if what I said is right. First time coming to the DOS Union Bar to report... Please give your guidance,各位 masters... |
|
| Floor9 lxmxn | Posted 2006-10-25 09:47 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by flyskygen at 2006-10-25 04:27: That's quite good. The meaning of for /l %i in (100,-2,60) do @echo %i is to sequentially display the number sequence on the screen: 100, 98, 96, 94,..., 62, 60. The three actual parameters in () are respectively the starting value, the step size (that is, the increase amount each time), and the last parameter is the end value, meaning that %i stops when it reaches 60. Another example: for /l %a in (1,1,255) do @net view 192.168.1.%a You can view the shared resource lists of machines with IPs from 192.168.1.1 to 192.168.1.255 in the local area network. |
|
| Floor10 ghtfuo | Posted 2006-10-25 23:58 |
| 初级用户 Posts 12 Credits 122 | |
|
The example above is very easy to understand. It's no different from VB, and even simpler. Just the one at the back, what does %a mean? in (1,1,255) do @net view 192.168.1. 1,1,255. Does it mean starting from 192.168.1.1, incrementing by one each time, and then exhaustively enumerating up to 255?
[ Last edited by ghtfuo on 2006-10-26 at 12:04 AM ] |
|
| Floor11 ghtfuo | Posted 2006-10-26 00:01 |
| 初级用户 Posts 12 Credits 122 | |
|
Are there also many syntax formats for statements like net view?
|
|
| Floor12 lxmxn | Posted 2006-10-26 00:53 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by ghtfuo at 2006-10-26 00:01: Re:ghtfuo In the command "for /l %a in (1,1,255) do @net view 192.168.1.%a" I mentioned above, %a is a variable. The specific value of this variable is the sequence of numbers from 1 to 255 represented by (1,1,255) in the parentheses (). This command means to execute 255 times. And the value of variable %a will increase by 1 each time the for is executed once, which is the step size (that is, the growth amount) I mentioned above. So the value of variable %a is 1, 2, 3, ……, 255, and then it increases to 255 in turn. When it reaches 255 (the end value), it will not execute, and the execution of this for command will terminate. After using this for command, %a represents these number sequences. So "net view 192.168.1.%a" means to execute "net view 192.168.1.1", "net view 192.168.1.2", "net view 192.168.1.3", ……, "net view 192.168.1.255". As for the syntax of net view, there are actually not many. The specific syntax can be viewed by using the "net help view" command to view its command-line help information. [ Last edited by lxmxn on 2006-10-26 at 12:55 AM ] |
|
| Floor13 ghtfuo | Posted 2006-10-26 01:03 |
| 初级用户 Posts 12 Credits 122 | |
|
Thanks.
%a refers to each number obtained by increasing by a step size, that is, the set of numbers in the subsequent (1, 1, 255) result, right? Can we use %b %c %d? Don't mind me being too inquisitive :D |
|
| Floor14 ghtfuo | Posted 2006-10-26 01:04 |
| 初级用户 Posts 12 Credits 122 | |
| Floor15 lxmxn | Posted 2006-10-26 01:36 |
| 版主 Posts 4,938 Credits 11,386 | |
Originally posted by ghtfuo at 2006-10-26 01:04: Re: ghtfuo I'm glad you got it. Because mastering the for command is a relatively difficult hurdle for friends who are just getting started with batch processing. In addition, a supplement: When executing the for command in the command prompt, variables are generally represented by one %, for example, using %a, %b, %i is all right. But when executing the for command in a batch processing, two %% are needed, for example, using %%i, %%a, %%p, etc. Also, variables are case-sensitive, for example, %%a and %%A are two different variables. [ Last edited by lxmxn on 2006-10-26 at 01:39 AM ] |
|
| 1 2 Next |
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |