Using:
mplayer "path\to\media\*.*"
doesn't work with MPlayer for Windows.
How do I play all files in a directory?
A nice way is to make playlists and play by i.e.
mplayer -loop 0 -playlist album.m3u
If you are in a directory of mp3 files you can pipe them to mplayer. On Windows it would be
mplayer dir *.mp3.
This will result in mplayer playing all mp3 files in directory. Keyboard controls like next / > are working now as well.
Easiest way to create playlists are by commandline, ie: on MSwindows
DIR *.mp3 /A-D/B/S/ON > playlist.m3u
will add all files in current and all subfolders to playlist.m3u.
mplayer dir *.mp3
doesn't work for me. It tries to play the file dir
. Also dir *.mp3 | mplayer
doesn't work. I have seen that I can play files like this: mplayer song1.mp3 song2.mp3 ...
; but how to pipe the songs? I have MPlayer Redxii-SVN-r36243-4.6.3
dir *.mts,*mp4 /A-D/B/S/ON > "%TEMP%\mp_playlist.txt" && mplayer.exe -loop 0 -playlist "%TEMP%\mp_playlist.txt"
It is now clear there is no option to play a folder in MPlayer. So we have to turn to the OS services.
The choice much depends on your creativity, anyway, for the Command Prompt forfiles
is rather standard (and a bit shorter than for
):
forfiles /p "path\to\media" /c "mplayer \"@file"
Add /s
before /p
to recourse subdirs.
Of course, use MPlayer path if its directory is not in the PATH
variable.
In Powershell replace \"
with 0x22
:
forfiles /p "path\to\media" /c "0x22mplayer0x22 0x22@file"
If you prefer something more native:
dir -file -r "path\to\media" | % {mplayer $_.fullname}
To recourse subdirs, use -r
near -file
.
None of these command is a breeze to type, therefore you might want to wrap them in a batch script.
I am able to use commands to run all MP3 files under a folder as below.
1st line: Add MP3 files to a playlist file (playlist.m3u
).
2nd line: Play the playlist file in Windows Media Player.
dir path\to\media /A-D/B/S/ON > playlist.m3u
start "wmplayer" path\to\playlist.m3u
for /r "C:\Music" %a in (*.mp3) do @mplayer "%~a"
help?