Add number List in For Loop without enabledelayedexpansion
Posted: 03 Jul 2015 21:15
I am attempting to create a subset of a large list and display it with a column of
numbers. There was no problem until I saw that ! marks in the text caused
problems with those lines of text when delayed expansion was enabled.
The problem was the disappearance of part of the text.
The following code produces zeroes with the text. Any hints or solutions would be appreciated.
numbers. There was no problem until I saw that ! marks in the text caused
problems with those lines of text when delayed expansion was enabled.
The problem was the disappearance of part of the text.
The following code produces zeroes with the text. Any hints or solutions would be appreciated.
Code: Select all
@Echo Off
Type NUL>tmp.txt
Echo three to get ready...>>tmp.txt
Echo four to go!>>tmp.txt
Set /A aCounter=0
For /F "tokens=*" %%a In (tmp.txt) Do (
Set /A aCounter+=1
Echo %aCounter% %%a
)