DOS: Recursive set command

Sample recursion to set one environment variable to a collection of text:

set COLLECTION=
setlocal ENABLEDELAYEDEXPANSION

for %%i in (a b c d e) do ( set COLLECTION=!COLLECTION! %%i.cpp )

:: result, COLLECTION=a.cpp b.cpp c.cpp d.cpp e.cpp
echo %COLLECTION%


No comments: