COPY Copy one local file to another location |
Top Previous Next |
Use this script command to copy the source file to the destination location.
For example, the following copies a file to a new folder and renames it.
COPY "c:\test\file" "c:\test2\file2"
If test2 is an existing folder, the following copies a file to the folder while retaining the original file name.
COPY "c:\test\file" "c:\test2"
Otherwise, file is copied to the root folder of drive C: and renamed to test2.
In this example, the /copydirs option is used to preserve the source directory structure in the destination folder:
:next GETFILE "*" IFERROR GOTO exit COPY %nextpath "c:\destination" /copydirs GOTO next :exit
Wildcard characters are not permitted with this command. Use the DOSCMD script command if you need to copy, append, or move multiple files with a single command.
Related command(s): MOVE, RENAME, MAKEFILENAME, APPEND, DELETE, DOSCMD, WORKINGDIR
|