I have a file FileLis.txt which contains the data as
file1.txt file2.txt file3.txt and so on.
Below part of the code %%a
displays the results exactly as my file list as above but when I assign the same to a variable it gets only first line (set "TARG_FILE=%%a"
).
Can anyone explain why is this difference in behavior and what is the correct way of writing it?
@ECHO off
SETLOCAL EnableDelayedExpansion
REM Write list of files of the input folder to a file
DIR /o-d /b c:\data\All_Inputfiles\*.* > D:\data\FileLis.txt
Set AllInputFile= D:\data\FileLis.txt
ECHO " %AllInputFile%>>D:\data\debuginfo.txt
for /f "tokens=*" %%a in (%AllInputFile%) do (
ECHO "Start of Main Loop Iteration#######################">>D:\data\debuginfo.txt
ECHO
set "TARG_FILE=%%a"
ECHO "TARG_FILE " %TARG_FILE% "line="%%a>>D:\data\debuginfo.txt
ECHO
)