我正在试验 XCOPY 和各种开关命令,试图创建一个 Windows 批处理文件来制作单个图像文件的多个(一组)副本。
我想:
命名要复制的文件;
说明所需的副本数量;
为文件的每个副本分配一个唯一的文件名。 (例如原始文件 0001.png,副本 0001-2.png、0001-3.png 等)
我非常感谢这方面的帮助,因为我的脚本知识有限。谢谢。
最佳答案
for /l %A in (1,1,100) do copy "C:\some folder\file.ext" "C:\some folder\file-%A.ext"
见
for /?
在批处理文件中使用
%%A
而不是 %A
在命令提示符下。FOR /L %variable IN (start,step,end) DO command [command-parameters]
The set is a sequence of numbers from start to end, by step amount.
So (1,1,5) would generate the sequence 1 2 3 4 5 and (5,-1,1) would
generate the sequence (5 4 3 2 1)
关于batch-file - Windows 批处理文件,用于制作单个文件的多个副本,每个副本都被分配一个唯一的文件名,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25293670/