|Let me see if I understand this correctly.|
1. All PDF file names are unique in their first six characters, right? So there is only one file beginning DC#001, and only one file beginning DC#002.
2. All you want to do is loop from 001 to 999, instead of asking the user to enter the next number manually, correct?
3. Referring to these two lines in your batch file:
for /f "tokens=*" %%a in ('dir /b dc#%xx%*.pdf') do set aa=%%a
echo %aa% >> List_of_all_reports.txt
the second line is not meant to be part of the loop, but is deliberately a separate statement coming after it, executed once the loop had ended. (I think reply #1 mistakenly thinks it was meant to be inside the loop.)
4. The loop is not really a loop because it only iterates once, since there is only one file. The only reason you have a FOR statement is to obtain the full filename matching the given wildcard, right?
So... if I guessed correctly what you want to do, you might want to try this...
for /l %%i in (1 1 999) do (
and then plug your batch file into this loop