Dos a one-liner command exist to copy a file to several directories, preferrably as part of a windows shell script? No external tools (such as robocopy) must be used.
The copy command allows use of different source files but one destination directory only.
Is there any possibility (or maybe a command line quirk) to overcome this restriction?
Or maybe a better command I should use?
Environment: WinXP, Win7 or Win10.
A file list (.txt file) that contains hundreds of file names and their destination folders.
Something like this (snip):
This was my first approach to walk through this list (destination folders has been created before via MD command):
FOR /F "tokens=1-2 delims=[space] [tab][space]" %%a in ('TYPE "FileList.txt"') DO ( COPY /N /Y %%a %%b >NUL 2>&1 || ECHO. Error copying %%~a to %%b && SET _Err=1)
Have a look at example entries 3 and 4: It's quite annoying for me to repeat the folder names for one specific file if it has to be copied to different places.
Any suggestions to improve this approach?
Much thanks in advance for any response