Using copy command, we can copy files from one directory to another directory. This command is similar to the Linux cp command, but it does not match with the full functionality of cp. Windows copy command can be used to copy files only, we can’t copy directories.
The syntax and usecases of copy command are explained below with examples.
Copy the contents of a file to another file
copy sourceFile destinationFile
Example: To copy a file from c:\data\file1.doc to D:\backup\file2.doc
copy c:\data\file1.doc D:\backup\file2.doc
If the destination file already exists you will be prompted for confirmation. To suppress this confirmation you can use /Y switch with copy command. This would be useful if you are executing copy command from a batch file.
+ Date:
Fri 3 Jul 2020 | Time: | By: Javad Nasrollahi
|