Copy Command in Windows.
Copy command in details to know how to copy one or more files from one location to another and merging two or more files into a single file.
Syntax
Copy Source_File Destination_File
/d | Allows encrypted files to be saved as decrypted files at the destination. |
/v | Verifies destination files are written correctly. |
/n | Uses a short file name, if available, when copying a file with a name longer than eight characters, or with a file extension longer than three characters. |
/y | Will not prompt you weather to overwrite an existing destination file. |
/-y | Prompts you to confirm to overwrite an existing destination file. |
/a | Indicates an ASCII text file. |
/b | Indicates a binary file. |
Source_File: Specifies the location from where you want to copy a file or set of files.
Destination_File: Specifies the location where you want to copy a file or set of files.
Combining files
If you specify more than one Source, with a plus sign (+), copy command combines the files into a single file. If you use wildcard characters (that is, * or ?) in Source and specify a single file name in Destination, copy command combines all files matching the file name in Source and creates a single file with the file name specified in Destination
Example…
In the current folder
COPY source_file.doc destination_file.doc
Copy from a different folder/directory:
COPY “C:\home\file1.doc” “D:\work\file2.doc”
Specify the source only, with a wildcard will copy all the files into the current directory:
COPY “C:\home\*.doc”
Specify the source with a wildcard and the destination as a single file, generally used with plain text files.
COPY “C:\my work\*.txt” “D:\New docs\combined.txt”
Combining files
Copy c:\file1.txt + c:\file2.txt File3.txt
Copy silently (no feedback on screen)
COPY source_file.doc destination_file.doc >nul