-3

I have a folder with some .mp4 files

I need to create a batch (locate in the same folder) that generate a concatlist.txt file structured like this:

file 'C:\Users\Administrator\Desktop\Nuova cartella (11)\DJI_0020.MP4' 
file 'C:\Users\Administrator\Desktop\Nuova cartella (11)\DJI_0022.MP4' 
file 'C:\Users\Administrator\Desktop\Nuova cartella (11)\DJI_0022.MP4' 
file 'C:\Users\Administrator\Desktop\Nuova cartella (11)\DJI_0023.MP4'

of the files drag and dropped into the batch

is it possible?

  • 2
    **I need to create a batch...**, is not a programming issue question, it is a statement of intent. You are not a brand new member of this site, so should know better [ask]. Please [edit] your question to post a [mcve] of the code you have written to perform the task, but which is exhibiting a single, specific, fully explained, debugged and replicable issue upon running. – Compo Aug 11 '22 at 15:45

1 Answers1

1

If you want to replace the existing "concatlist.txt" file, remove the REM from the third line, otherwise, this will append to an existing concatlist.txt file.

@ECHO OFF
SET "OutFile=concatlist.txt"
REM COPY NUL "%OutFile%" >NUL
:StartFileWriteLoop
    IF "%~1" == "" GOTO :ExitFileWriteLoop
    ECHO;file '%~1'>>%OutFile%
    SHIFT
GOTO :StartFileWriteLoop
:ExitFileWriteLoop
ECHO;Doing other work
PAUSE

EDIT: Mild re-write of code allowing other commands to be ran afterwards, and also prevent COPY NUL command from reporting a file was copied.

Darin
  • 1,423
  • 1
  • 10
  • 12
  • thank! it works, just only one question: can it be modified so that when the outfile (concatlist.txt) with the list of drag and drop has created, the batch can continue a script with other command in the space below the "GOTO :Start" ? – user3572760 Aug 11 '22 at 18:45
  • @user3572760, see updated code. – Darin Aug 11 '22 at 18:57