@echo off
setlocal
for /f "usebackqdelims=" %%i in ("yourtextfilename.txt") do (
ECHO XCOPY "%%i" "c:\yourdestfolder\"
)
for each line in the filename, where the filename is in double-quotes (usebackq
) assign each line of the file to %%i
in turn and XCOPY
that file to c:\yourdestfolder\
The PROPOSED XCOPY will be echoed to the screen. This is deliberate to allow you to make sure that is what you want to do. To EXECUTE the XCOPY
simply delete the ECHO
keyword before it. If the "1 files copied" response irritates you, add >nul
after "c:\yourdestfolder\"
if you want to suppress the message.
"c:\yourdestfolder\" will be CREATED by XCOPY if it does not already exist. XCOPY will ask whether you want to overwrite existing files if there is already a file with the same name in "c:\yourdestfolder\" - which is why you may NOT want to suppress the messages.