如何使用批处理文件复制文件?

时间:2011-12-20 11:25:05

标签: windows batch-file copy

我需要创建一个批处理文件,将某些文件(例如,19_1_White.jpg)复制到目录中的文件夹中。我怎么能这样做?

2 个答案:

答案 0 :(得分:9)

XCOPY F:\*.* G:\ /C /S /D /Y /I

XCOPY allows for copying of files, directories, and sub directories.
F:\*.* is our source location
G:\ is our destination location
/C tells XCOPY to ignore errors, and finish what can be done
/S tells XCOPY to copy everything including directories and
subdirectories
/D tells XCOPY to only copy source files that are newer than the
destination files (big time saver on the process)
/Y tells XCOPY to overwrite files without asking for confirmation
/I tells XCOPY to automatically create new directories on the
destination, if new directories were created in source.

答案 1 :(得分:2)

您需要使用命令XCOPY 例如XCOPY A.jpg C:\ Folder \ A.jpg

请查看https://support.microsoft.com/en-us/help/289483/switches-that-you-can-use-with-xcopy-and-xcopy32-commands以了解您可能还想使用的其他任何开关。