tinfanide wrote:Just one little question that I cannot search the Internet for explanation:
What is "(" and ":"?
Well that really is 2 questions dealing with 2 unrelated subjects
ECHO( is a way of echoing a blank line. If the line we are attempting to echo is empty and we use simply
ECHO then you will get
ECHO is on. as the output. This is a possibility with your code because you could run accross a line that consists solely of spaces, which then get stripped to a blank line.
Most people use
ECHO. instead of
ECHO(, but
this thread demonstrates shortcomings of
ECHO. and there is a general consensus that
ECHO( is the safest variant.
The colon (:) is part of the syntax used for string substitution. The code is using !ln! instead of %ln% to get delayed expansion because it is inside a FOR loop. %ln% would give the value of ln before the LOOP was parsed - which would be empty: not what we want
-
!VAR! gives the value of VAR
-
!VAR:SEARCH=REPLACE! gives the value of VAR after any occurrance of SEARCH is replaced by REPLACE.
So
!ln: =! simply gives the value of ln after all instanses of <space> have been stripped (replaced with nothing).
Use HELP SET to get more info on delayed expansion and string substitution.
Dave Benham