Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Batch file 将多个目录中的文件复制到一个文件夹中_Batch File_Cmd - Fatal编程技术网

Batch file 将多个目录中的文件复制到一个文件夹中

Batch file 将多个目录中的文件复制到一个文件夹中,batch-file,cmd,Batch File,Cmd,我在多个目录中有许多图片,希望将它们复制到一个文件夹中,但当目标文件夹中已存在同名文件时,我的脚本被中断。我试过了 for /R d:\dups %f in (*.jpg) do copy "%f" d:\pictures\. 在将较新文件复制到目标文件夹之前,我可以向代码中添加哪些内容以附加该文件的名称?我的源目录是“d:\dups”,目标文件夹是“d:\pictures”。谢谢 示例: @echo off for /R "d:\dups" %%f in (*.jpg) do copy "%

我在多个目录中有许多图片,希望将它们复制到一个文件夹中,但当目标文件夹中已存在同名文件时,我的脚本被中断。我试过了

for /R d:\dups %f in (*.jpg) do copy "%f" d:\pictures\.
在将较新文件复制到目标文件夹之前,我可以向代码中添加哪些内容以附加该文件的名称?我的源目录是“d:\dups”,目标文件夹是“d:\pictures”。谢谢

示例:

@echo off
for /R "d:\dups" %%f in (*.jpg) do copy "%%f" "d:\pictures\New-%%f"

批量生产是一项要求吗?在VBScript或PowerShell中执行此操作要容易得多。