Reputation: 1837
Is it possible to define a list of directories e.g. "dir1", "dir2" and then for each of those directories execute a couple of actions, eg:
xcopy C:\test\*.dll D:\%%le_dir%%\dll /Y
xcopy C:\test\*.exe D:\%%le_dir%%\exe /Y
where le_dir
is a directory from the defined list
Upvotes: 1
Views: 435
Reputation: 37569
Try this (the list is in a text file):
for /f "delims=" %%i in (list.txt) do (
xcopy "C:\test\*.exe" "D:\%%i\exe" /Y
xcopy "C:\test\*.dll" "D:\%%i\dll" /Y
)
Put the destination folders in a text file list.txt
:
dir1
dir2
...
Edit1 (folders are defined in the script):
set "folders=dir1 dir2 dir3"
for %%i in (%folders%) do (
xcopy "C:\test\*.exe" "D:\%%i\exe" /Y
xcopy "C:\test\*.dll" "D:\%%i\dll" /Y
)
Edit2 (if there are spaces in folder names):
set "folders="dir 1" "dir 2" "dir 3""
for %%i in (%folders%) do (
xcopy "C:\test\*.exe" "D:\%%~i\exe" /Y
xcopy "C:\test\*.dll" "D:\%%~i\dll" /Y
)
Edit3: ")" added.
Upvotes: 4