I want to concat each a.txt in C:, D:, and E:.
@echo off
setlocal EnableDelayedExpansion
set list=C:
set list=%list%;D:
set list=%list%;E:
set "file_list="
for %%f in (%list%) do (
set "file_list=%file_list% %%f\a.txt"
)
echo "file_list=%file_list%"
I expect the output is file_list=C:\a.txt D:\a.txt E:\a.txt,
but the actual output is file_list= E:\a.txt
The topic Variables are not behaving as expected doesn't answner my question!