Hello
I am trying to perfect a batch file that uses FFMpeg to convert videos to MP3's.
As an example the title of the video might be something like
David Bowie - Life on Mars.mp4
or maybe
David Bowie - Greatest Hits - Life on Mars.mp4
I'd like to extract the track title "Life on Mars" from these filenames to create ID tags in the MP3 file and have loaded the filename into a variable like %filename%.
Please could you suggest some code that would edit %filename% to give the desired result?
Basically I need to search backwards from the end of the string until I encounter the first "<Hypen><Space>" and only save the text that comes afterwards in %filename%.
Thanks
Robin
Editing a variable (Searching from end)
Moderator: DosItHelp
Re: Editing a variable (Searching from end)
I think this line solve your problem:
If you change the <space><hypen><space> by a backslash, then the title takes the place of a file name that can be directly extracted via %%~Na FOR parameter modifier.
Code: Select all
for %%a in ("%filename: - =\%") do set "title=%%~Na"