【发布时间】:2015-11-04 03:38:11
【问题描述】:
假设我有一个批处理文件 script.bat。此批处理文件放置在父文件夹中。
> Parent folder
script.bat
> subdirectory1
file1.1
file1.2
file1.3
> subdirectory2
file2.1
file2.2
file2.3
如何编写批处理文件,以便当我双击它时,它将所有文件从(子目录内)复制到(批处理文件所在的文件夹)?
【问题讨论】:
-
for /d %%I in (*) do copy "%%~I\*" . -
谢谢,成功了。在这里批处理菜鸟,您能解释一下该命令的每个组件的作用吗?
-
@rojo,发布您的解决方案作为答案怎么样?所以OP可以接受它(希望;-))并且问题不再在SO数据库中保持开放......
-
@jameschang 应 aschipfl 的要求,解释已移至答案。
标签: windows shell batch-file batch-processing command-prompt