Use the command to copy a file using its specific name and file extension or use a wildcard to copy groups of files at once, regardless of the file names or extensions. Some other command options include verification that the files were copied correctly and suppression of prompts to overwrite files of the same name.
Copy Command Availability
The copy command is available from within the Command Prompt in Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP, as well as from the Advanced Startup Options and System Recovery Options repair/recovery menus.
Copy Command Syntax
The command accepts the following general form: copy [/d] [/v] [/n] [/y | /-y] [/z] [/l] [/a | /b] source [/a | /b] [+ source [/a | /b] [+ …]] [destination [/a | /b]] [/?]
Copy Command Examples
Below are several examples of how to use the copy command:
Copy to a Different Folder
The copies program.iso from the Z: drive to the user’s Programs folder.
Copy and Rename
You can use the copy command to rename a file and even change its file extension. In this example, the j93n.exe file copies to a new folder on the Y: drive as m1284.msi. In the above example, the atapi.sy_ file, located in the i386 folder on the Windows XP installation CD, is copied to the C:\Windows directory as atapi.sys. Unlike the Y: drive example above, this one is a bit more realistic, since copying files like that from a disc is a common practice when fixing some specific Windows problems.
Copy to Current Path
In this example, the copy command has no destination specified, so the readme.htm file is copied to whatever directory you typed the copy command from. For example, if you type copy d:\readme.htm from the C:\Windows> prompt, that HTM file will be copied to C:\Windows.
Copy Only Certain File Types
This command copies all MP3s (*.mp3) from the Downloads folder to the Music\DownloadedMusic\ folder, but we want to make sure that every file is copied, even if there’s already one in DownloadedMusic with the same name (/y). We’ll verify the copy (/v) to make sure Command Prompt tells us whether the files were actually copied or if an error happened in the process.
Merge Files Into One
This will merge three TXT files into a new one called combined.txt. As you can see, each file that should be part of the merge need to be separated by a + sign, but no spaces. You can also use the asterisk to append multiple files. So, in our example, we could replace all those .txt instances with Z:*.txt, but only if we want to merge every single TXT file from the Z: drive.
Copy Related Commands
This command is similar to the xcopy command, but unlike copy, xcopy works on folders, too.