Good morning, today I bring you a trick, that a friend designed me, although, the original idea is mine and I wrote it once, but when corrected this is the result.
Imagine that in a folder they have a huge collection of music videos, cartoons (without continuity) or just a large number of various files.
These files want to place them randomly to the winamp list for playback and to play them.
For this you have to create an MS-DOS batch batch file
In a new block of notes paste the following code:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@Echo OFF & chcp 1252 >NUL & Setlocal enabledelayedexpansion
REM Title %~n0 & Mode con cols=50 lines=3
Set /A "MAX=30"
Set "TMP_Playlist=%Temp%\Playlist.tmp"
Set "Playlist=%Temp%\Playlist.m3u"
:List
(
For /F "Tokens=*" %%$ in (
'Dir /B /S "%~dp0" ^| Findstr /I /R "\.avi$ \.mkv$ \.mp4"'
) DO (
Echo !Random!!Random!!Random!;%%$
)
)>"%TMP_Playlist%"
:Randomize
(
For /F "Tokens=2* Delims=;" %%$ in (
'Type "%TMP_Playlist%" ^| Sort '
) DO (
Set /A "Count+=1"
If !COUNT! LSS %MAX% (
Echo %%$
) ELSE (
Goto :Run
)
)
)>"%Playlist%"
:Run
Start /B "" "%PROGRAMFILES(X86)%\Winamp\winamp.exe" "%Playlist%" || (Exit /B 1)
ping localhost -n 8 >nul
Exit /B 0
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Finally, save it in the same folder where you have the videos with extension .bat
When the file is executed, it will be added to the list and the files indicated will be reproduced randomly
In this case to say the amount of videos modify this line to your need
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Set /A "MAX=30"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
And the extensions in this line:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
'Dir /B /S "%~dp0" ^| Findstr /I /R "\.avi$ \.mkv$ \.mp4"'
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
I hope it serves you, I use it every day, for my community TV channel.