I'm trying to loop through a text file found during a wildcard search and append each line as its own portion of a string.
My file has the two lines:
Load.SQL.Sample.Basic.Data
Script.Calc.Sample.Basic.AggAll
I want to loop through them and aggregate them into one variable. At each step I want it to echo what's in the variable:
Load.Sql.Sample.Basic.Data
Load.Sql.Sample.Basic.Data Script.Calc.Sample.Basic.AggAll
This script just replicates the input file:
set JOBLIST=
FOR %%i in (*.Job.txt) DO (
FOR /F %%a in (%%i) DO (
SETLOCAL EnableDelayedExpansion
set JOBLIST=!JOBLIST! %%a
echo !JOBLIST!>>Test.txt
ENDLOCAL
)
)
This is the output (each line has a leading space):
Load.SQL.Sample.Basic.Data
Script.Calc.Sample.Basic.AggAll