Home » How to Copy a File in CMD

How to Copy a File in CMD

You can use the copy command in Command Prompt (CMD) to copy a file:

copy source_file_path destination_file_path

This particular example will copy the specified file to the new location.

The following example shows how to use this syntax in practice.

Example: Copy a File in CMD using Copy

Suppose that we want to copy a file named test.txt from the following source directory:

C:\Users\admin\Documents\cmd_script

to the following destination directory:

C:\Users\admin\Documents\cmd_script\apps

We can type the following command to copy the file:

copy C:\Users\admin\Documents\cmd_script\test.txt C:\Users\admin\Documents\cmd_script\apps\test.txt

Output: 👇️

CMD - copy a file
CMD – copy a file

We can see that the file test.txt has been copied from C:\Users\admin\Documents\cmd_script to C:\Users\admin\Documents\cmd_script\apps\.

Conclusion

You can use the copy command followed by the source file path and the destination file path to copy a file to any location on your system.

You can find more topics about Active Directory tools and PowerShell basics on the ActiveDirectoryTools home page.