如何复制使用Windows批处理文件? [英] How do I copy files using Windows Batch?

查看:204
本文介绍了如何复制使用Windows批处理文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个子目录与文件的目录。结果
我如何能在子目录中的所有文件复制到新的位置?搜索

I have a directory with several subdirectories with files.
How can I copy all files in the subdirectories to a new location?

编辑:我不想复制的目录,只是将文件...

I do not want to copy the directories, just the files...

由于这仍是在XP,我选择了以下解决方案:

As this is still on XP, I chose the below solution:

 for /D %S IN ("src\*.*") DO  @COPY "%S\" "dest\"

谢谢!

推荐答案

确定。有了您的编辑,说你不想要的目录结构,我想你会想用这样的:

Ok. With your edit that says you don't want the directory structure, i think you're going to want to use something like this:

for /F "usebackq" %s IN (`DIR /B /S /A-D SrcDir`) DO @(
    XCOPY %s DestDir\%~nxs
)

这篇关于如何复制使用Windows批处理文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆