I've created a batch file that will output a .m3u playlist of mp3 files. I want to be able to have my .m3u playlist be in track order.
@echo off
chcp 1252
cd %1
echo %~f1
exiftool -q -p "$Filename" -fileorder TrackNumber -ext mp3 -ext flac -ext m4a . > "%~nx1.m3u"
I've placed exiftool in my c:\ dir as well as tried it in c:\windows. I've added these locations to my path in Windows 10.
The file is created but is empty.
I've tried both a manual start using the batch file from the command line as well as using a right-click of a folder using a registry edit.
Any help is appreciated.
Welcome to the forums, sorry I couldn't be more helpful on reddit.
QuoteI've tried both a manual start using the batch file from the command line
Unfortunately, it won't work from the command line as it is. From the command line by itself, it will take the current directory as the target. If you add a directory as an argument on the command line, it should work if it's on the same drive, but it won't if the target directory is on a different drive.
Try dragging the bat file to the desktop and then dropping a directory on it. That's what worked for me. Also, what version of Windows are you using?
Reddit thread source (https://www.reddit.com/r/techsupport/comments/51hr4y/m3u_creation_via_right_click/) for anyone else to catch up with.
I do notice one mistake that I made, but it shouldn't have affected the results. It should be Track and not TrackNumber. Not sure where I dug TrackNumber up from.
Running Windows 10.
The music is on the H:\ drive
Also - the registry edit I have made to allow me to right click on the folder is this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\play]
@="Make playlist(s)"
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\play\command]
@="cmd /C C:\\makeplaylist.bat \"%L\""
Try changing the 3rd line from this:
cd %1
to this
cd /D %1
I should have looked at your bat file a bit closer. The /D option changes the drive as well as the directory.
Maybe there's a problem with the files.
Try changing the -q option to -k and see what Exiftool reports.
Got this to work by placing exiftool in the root of the drive that my music files are in.
But now I have a new problem: If there's an & in the directory name, the batch file doesn't like it and does not recognize everything after the &
Here is a 1 line BAT file that creates a playlist in whatever folder is provided as its argument.
exiftool -q -p "$Filename" -fileorder TrackNumber -ext mp3 -ext flac -ext m4a %1 > "%~1\playlist.m3u"
I can't say it will work for any folder path, but it works for folders with "&" in the path.