The file I want to copy is located in "C:\Report\" and the filename I want to copy is something like "rptXXXX.txt". What I want to do is write a batch that copy the file that the filename is start with "rpt".
The destination folder is "F:\Project\Report\".
%%i is simply the loop variable. This is explained in the documentation for the for command, which you can get by typing for /? at the command prompt.
Batch File to Copy FilesUse the command simply called "Copy." Generally, put the word copy on one line, followed by the original file and where you want it copied, such as "copy C:\Example\Example. txt C:\Example2\Example2. txt."
Highlight the files you want to copy. Press the keyboard shortcut Command + C . Move to the location you want to move the files and press Command + V to copy the files.
This should work, you can use an * as a wildcard:
xcopy e:\foo\rpt*.txt e:\foo2
or in your case,
xcopy C:\Report\rpt*.txt F:\Project\Report\
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With