I am writing a batch file to convert music files and have saved a file name in a variable. A couple of examples would be:
David Bowie - Space Oddity.mp3
Or maybe
David Bowie - Greatest Hits - Space Oddity.mp3
I'd like to edit the variable so it just contains the track name Space Oddity
. So I need to search backwards from the end until I reach the first occurrence of {Hyphen}{Space}
, and discard everything that comes before it, (since the variable might contain more than one hyphen).
Please could you suggest some batch code to achieve this?