I think I have it worked out now.
Rather than use a second loop after the first, call the second loop as a subroutine from inside the first loop as follows:
@echo off
Title Extarct word from list
SetLocal EnableDelayedExpansion
set "attribs=-r--s----"
set "line=Directory;Read Only;Archived;Hidden;System File;Compressed File;Offline File;Temporary File;Reparse point"
echo Attributes: %attribs%
@for /L %%G IN (0,1,8) DO (
set val=!attribs:~%%G,1!
if not "!val!"=="-" (
set "num=%%G"
set /A num+=1
call :reit
)
)
pause
exit
:reit
@for /f "tokens=%num% delims=;" %%i in ("%Line%") do (
set "word=%%i"
echo The extracted word is = !word!
)
goto :eof
Pause & EXIT
Just on the side, how do you insert code into the post as you have done Hackoo?