Passing tokens beyond the restricted limit via for
Posted: 25 May 2011 17:07
An oldie but a goody. There are plenty of work arounds to this question already in existence, just sharing one that I had come up with some time ago.
Code: Select all
@echo off
setlocal
set file=%~1
set token=1
for /f "tokens=*" %%- in (%file%) do (
set str=%%-&&call :NEXT
)
goto :eof
:NEXT
for /f "tokens=1,*" %%a in ("%str%") do (
echo.[%%a] is the %token% token
set str=%%b
)
set /a token=%token%+1
if "%str%"=="" goto :eof
goto :NEXT