I'm trying to find a way to make nested for loops work, but this iteration is different than the most popular results (where an OP is looping through directories, or using a numerical for /l
loop, etc.)
Instead, I'm trying to figure out how to make this work:
@echo Off
setlocal enabledelayedexpansion enableextensions
for /f "Tokens=1-7 Delims=_" %%P in ("Testing_This_GREAT_Thing_Of_An_IDEA") do (
Echo %%P
For %%a in (P Q R S T U V ) do (
Call set "term=%%%%%%a"
Call echo !term!
Call set term=%%term%%
Call Echo !term!
Call set term=%%term%%
Call Echo !term!
If not "!term!"=="" Call set word.%%a=%%term%%
Echo word.%%a = "!word.%%a!"
)
)
pause
exit /b
Desired output of For %%a in (P Q R S T U V)
loop would be to have:
word.P=Testing
word.Q=This
word.R=GREAT
word.S=Thing
word.T=Of
word.U=An
word.V=IDEA
Obviously the following would be as expected for the initial loop, but I cannot get the delayed expansion
(I assume) to work as expected. . . .
%%P=Testing
%%Q=This
%%R=GREAT
%%S=Thing
%%T=Of
%%U=An
%%V=IDEA