It seems that everyone lacks thorough practical spirit!
After discussing for so long, only after testing was it discovered that there are major problems in ppdos and the simplified code of zh159. Because all their codes can't stand the test of multiple runs.
The result of the first run is correct, for example, it's 7. But the result of the second run is wrong. It should be 14, but it's still 7. The third time is still wrong. It should be 21, but it's 14.
That is to say, in the environment where setlocal is not set, the environment variables will increase with the number of runs. But what is called and echoed out is always the result before the for execution. Unless the variable called and echoed is empty before this code runs.
The final conclusion is that it's impossible to completely replace echo!var! with call echo %var% in the connection statement
So the final argument I showed in the middle of building 26 is wrong.
Of course, this doesn't affect the view I mentioned in building 30. for+call can completely replace for+delay
As for the code in building 40, in addition to the common problems mentioned above, the idea also takes a detour. To not display set /a, only a @ mark is needed. There's no need to bring out the big gun of echo off.
(for /f %i in ('dir /b') do @set /a n+=1 >nul)&call echo There are %n% under the directory
But I still declare that this kind of abbreviation is very meaningless. Execute for first and then echo %n%, which is simple and clear, and won't have the above problems I mentioned. Why bother!
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
| plp626 |
+15 |
2008-06-27 23:59 |