I have found and tried many examples to count the number of tokens in a for /f loop but I only get a count of 1.
This is what I have tried (my best attempt after a lot of hacking):
@echo off
setlocal EnableExtensions EnableDelayedExpansion
set "inputVar=13:45:33"
echo inputVar = %inputVar%
set tokenCount=0
for /F "tokens=* delims=:" %%I in ("%inputVar%") do (
set /a tokenCount=%tokenCount% + 1
set II=%%I
set JJ=%%J
set KK=%%K
)
echo tokenCount = %tokenCount%
echo II = %II%
echo JJ = %JJ%
echo KK = %KK%
pause
exit
So, what's wrong? Or, what will work?
I changed tokens=1-3 to tokens=* and I expected the tokenCount to equal 3.
This is just a portion of my total script to simplify the question of how I can determine how many tokens were processed.