top of page

XCOPY batch file to copy files

You can write a simple batch file script to copy files from one location to another in this format:

The command XCOPY comes first, followed by the path of the file you want to copy, and then the destination folder you want the files copied to. You can repeat this line of script for as many files as you want to copy.

As explained in past tips on how to use batch files to delete files; and to create folders, when you have the script set up the right way you just need to change the extension to '.bat', and double-click.

The real insider tip here tonight is to avoid the mistake of naming the batch file with the command 'XCOPY'. So when using this script if you click on a file named xcopy.bat instead of the script executing it will get caught in a loop, and nothing will be copied. You'll see this in the command prompt:

Naming the file copy.bat will do the trick.

bottom of page