The Download
- The copy command helps you duplicate a file and place it somewhere else on your computer.
- You can copy multiple files at once and even rename them using the copy command.
The copy Command Prompt command duplicates a file, allowing you to store the copy in a location of your choice.
This command lets you copy a file using its specific name and file extension or employ a wildcard to copy multiple files simultaneously, regardless of file names or extensions. It offers options for verifying successful file copies and suppressing overwrite prompts for files with the same name.
Copy Command Availability
The copy command is accessible from the Command Prompt in Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP. It's also available in the Advanced Startup Options and System Recovery Options repair/recovery menus.
Certain copy command options and syntax may vary based on the operating system.
Copy Command Syntax
The command follows this general format:
copy [/d] [/v] [/n] [/y | /-y] [/z] [/l] [/a | /b] source [/a | /b] [+ source [/a | /b] [+ ...]] [destination [/a | /b]] [/?]
Refer to How to Read Command Syntax if you need help interpreting the copy command syntax outlined above or in the table below.
| Copy Command Options | |
|---|---|
| Item | Explanation |
| /d | Allows the destination file to be created decrypted. |
| /v | Verifies that new files are written correctly. |
| /n | Uses short file name, if available, when copying a file with a non-8dot3 name. |
| /y | Suppresses confirmation prompts to overwrite the destination file if it's the same name as the source file. |
| /-y | Shows confirmation prompts to overwrite a file if the source file name is identical to the destination file name. |
| /z | Copies networked files in restartable mode. |
| /l | Copies the link to the source instead of the actual file that the source points to. This is only relevant if the source is a symbolic link. |
| /a | Indicates an ASCII text file. |
| /b | Indicates a binary file. |
| source | This is the location and name of the file you want to copy. The source may not be a folder, and you may not use wildcard characters (the asterisk). |
| destination | This is the location and/or file name to which the file specified in the source should be copied |
| /? | Use the help switch with the copy command to show detailed help about the command's several options. |
You can append files by selecting several source files but specifying only one destination file.
Copy Command Examples
Here are several examples of how to use the copy command:
Copy to a Different Folder
copy Z:\Software\program.iso C:\Users\Jon\Downloads\Programs\
This example copies program.iso from the Z: drive to the user's Programs folder.
Take note of the space between these commands. It's not immediately obvious, but the only spaces in this copy command example are after copy and between the source and destination files.
Copy and Rename
copy Y:\install\j93n.exe Y:\more\m1284.msi
You can use the copy command to rename a file and change its file extension. In this example, the j93n.exe file is copied to a new folder on the Y: drive as m1284.msi.
This isn't a file conversion technique (i.e., the EXE file isn't actually being converted to MSI). Instead, it's a way to make an identical copy but with the destination file saved under a different name and in a different folder.
copy D:\i386\atapi.sy_ C:\Windows\atapi.sys
In the example above, 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, this one is more realistic since copying files from a disc is a common practice when fixing specific Windows problems.
Copy to Current Path
copy D:\readme.htm
In this example, the copy command has no specified destination, so the readme.htm file is copied to the directory from which you typed the copy command.
For instance, if you type copy d:\readme.htm from the C:\Windows> prompt, the HTM file will be copied to C:\Windows.
Copy Only Certain File Types
copy /y /v C:\Users\Jon\Downloads\*.mp3 C:\Users\Jon\Music\DownloadedMusic\
This command copies all MP3 files (*.mp3) from the Downloads folder to the Music\DownloadedMusic\ folder. Ensure that every file is copied, even if one with the same name already exists in DownloadedMusic, by using the /y switch. Verify the copy with the /v switch to see if the files were successfully copied or if an error occurred during the process.
A folder must already exist in the destination location before the copy command can transfer files to it. Create new folders in Command Prompt with the mkdir command.
Merge Files Into One
copy Z:\file1.txt+Z:\file2.txt+Z:\file3.txt Z:\combined.txt
This command will merge three TXT files into a new file called combined.txt. Each file to be merged should be separated by a plus sign (+) without spaces.
You can also use the asterisk to append multiple files. For example, replace individual .txt entries with Z:\*.txt to merge every TXT file from the Z: drive into one.
Copy Related Commands
This command is similar to the xcopy command, but unlike the copy command, xcopy also works on folders.
It's not necessary to use a command if you'd rather copy a file in Windows using File Explorer.