Generate an .m3u playlist from all the music files in a folder — straight from the Windows Explorer right-click menu.
create_playlist.py takes a directory, walks it recursively and writes an #EXTM3U playlist next to
the music files. The playlist is named after the folder (My Album/My Album.m3u) and contains one
absolute file path per track.
Recognised extensions: .mp3, .wav, .flac.
add_context_menu_entry.bat wires the script into Windows Explorer, so you can right-click any folder
and pick Generate Playlist.
- Windows (for the context menu integration)
- Python 3.x — no third-party packages needed
-
Clone or download this repository:
git clone https://github.com/rennerdo30/PlaylistFromFolder.git cd PlaylistFromFolder -
Open
add_context_menu_entry.batin a text editor and pointpython_pathat your Python interpreter. It defaults to:set "python_path=C:\Python312\python.exe"
Use
where pythonin a terminal to find yours. -
Run
add_context_menu_entry.batas administrator (right-click -> Run as administrator). It writes the registry keys underHKEY_CLASSES_ROOT\Directory\shell\GeneratePlaylist; without elevation the script exits with a warning.
From Explorer: right-click a folder containing music files and choose Generate Playlist. The
.m3u file appears inside that folder.
From the command line: the script works standalone, no registry entry required.
python create_playlist.py "D:\Music\My Album"reg delete "HKEY_CLASSES_ROOT\Directory\shell\GeneratePlaylist" /fRun this from an administrator command prompt.
- Subfolders are included — running it on a folder of albums produces one playlist covering all of them.
- Paths written to the playlist are absolute, so moving the music afterwards breaks the playlist.
- An existing playlist with the same name is overwritten.
MIT — see LICENSE.