I am using Loop.bat to call copy.bat as given below
Loop.bat
FOR %%G IN (2 3 4) DO COPY.bat %%G
Copy.bat
@echo OFF
setlocal ENABLEDELAYEDEXPANSION
SET DIR = C:\B%1_DATA\
for %%s in (^
!DIR!B%1_File1.dat^
!DIR!B%1_File2.dat )^
do xcopy /y %%s C:\Temp
The %%S
appears as
B2_File1.dat
I want to append the directory path so that it becomes C:\B2_DATA\B2_File1.dat
Why isn't DIR
variable not recognized inside for loop? I have also tried %DIR%
.