I saw another thread about music, so I decided to whip up some code that somebody might appreciate...as a learning tool, it's practically useless otherwise lol.
If you put that in a folder with all your music (even in sub-folders), it will find all of the mp3 and wav files (easily changeable) and add them to a list. Then it takes a random file from the list (avoiding repeating the song) and plays it. It will wait for the file to finish playing, where it then repeats the process.
This should work on Vista, and probably on 7 as well. I know it works on XP, but if it doesn't work on your OS then you can always look at the code and see how it works.
Code
@echo off
setlocal enabledelayedexpansion
set amnt=0
set last=NONE
call :check mp3
call :check wav
:loop
cls
set /a rnd=%random%%%%amnt%
if %rnd%==%last% goto loop
set last=%rnd%
echo !file%rnd%!
start /min /wait mplay32 /play /close !file%rnd%!
goto loop
:check
for /f "delims=" %%A in ('dir /b /s *.%1') do (
set file!amnt!="%%~A"
set /a amnt+=1
)If you put that in a folder with all your music (even in sub-folders), it will find all of the mp3 and wav files (easily changeable) and add them to a list. Then it takes a random file from the list (avoiding repeating the song) and plays it. It will wait for the file to finish playing, where it then repeats the process.
This should work on Vista, and probably on 7 as well. I know it works on XP, but if it doesn't work on your OS then you can always look at the code and see how it works.



![[Image: chain.png]](https://i.postimg.cc/NFnfH9zY/chain.png)