Copy files from Network Mapped Drive
I am trying to copy a file over from a mapped drive on a network to the current computer through a batch file.
I've already attempted the following below and still no results. The plan is to run a batch file to copy a file from a network drive down to the local C:\ drive.
@echo off
copy H:\Videos\TargetVideo\TargetVideo.mp4 C:\Video\
You can use XCOPY with the /Y
switch to suppress prompting and confirm overwriting the destination file with the source file if it already exist, and you can use the /F
switch to display the full source and destination file and path during the copy operation.
Additionally, be sure to put double quotes around the full source file and the destination path. Also, be sure to turn @ECHO ON
in the script to see this output detail from the command window.
Example Script Drive Letter
xcopy /y /f "H:\Videos\TargetVideo\TargetVideo.mp4" "C:\Video\"
You could use the UNC path rather than the drive letter which the actual drive letter points to:
Example Script UNC Path
xcopy /y /f "\\<server>\<share>\Videos\TargetVideo\TargetVideo.mp4" "C:\Video\"
Further Resources
- XCOPY
- ECHO