0

我想创建视频文件(.mp4)格式的副本,每个副本交替编号,例如:文件说 01.mp4,因此下一个副本应命名为 03.mp4 05.mp4 07.mp4 等。 任何帮助是极大的赞赏。谢谢,

4

1 回答 1

0

如果您的意思是要以增量方式复制相同的文件,您可以使用批处理脚本尝试类似的操作:

@echo off
set Source=C:\TEMP\MyFile.mp4
set Destination=E:\MyData\
set Filename=MyDoc
set a=1

:loop
if exist %Destination%\%Filename%(%a%).txt set /a a+=1 && goto :loop
copy %Source% %Destination%\%Filename%(%a%).mp4
pause

注意:如果这不是您想要的,只需编辑您的问题并在您的请求中更加明确,并尝试向我们提供代码以更多地了解您的目标和问题!

编辑于 27/03/2017 @ 15:00

这是另一种使用数组进行复制的方法:

@echo off
Title Search for images files
mode con cols=75 lines=5 & Color 0A
set "Folder=%USERPROFILE%\Videos"
set "Destination=%userprofile%\desktop\TestCopy"
If Not Exist "%Destination%" MD "%Destination%
set "Count=0"
set "EXT=mp4"
Set "Msg=Please wait a while scanning for"
Setlocal Enabledelayedexpansion
For %%a in (%EXT%) Do ( 
    FOR /f "delims=" %%f IN ('dir /a-d /b /s "%Folder%\*.%%a"') DO (
        Rem We increment the variable Count
        SET /a "Count+=1"
        rem populate the array variable list with the name of files with their extensions
        set "list[!Count!]=%%~nxf"
        rem populate the array variable list with the name of files without their extensions
        set "listName[!Count!]=%%~nf"
        Call :Scanning "%%~nxf"
        rem populate the array variable listpath with the whole path of files
        set "listpath[!Count!]=%%~dpFf"
    )
)
for /L %%i in (1,1,%Count%) do (
    Copy /y "!listpath[%%i]!" "%Destination%\%%i_!listName[%%i]!.mp4">nul 2>&1
)
Explorer "%Destination%" & Exit
::****************************************************************************
:Scanning %1
Cls
echo( & echo(
echo            %Msg% %1
exit /b
::****************************************************************************
于 2017-03-27T11:52:11.610 回答