.bat start random file

April 26, 2011 at 19:23:26
Specs: Windows 7
Hello, I have a folder in my computer that contains all the episodes from South Park. I saw the random episode program on their website and i thought it was nice to make a batch file that does the same thing.

I have one folder and i want to make the batch file inside that folder.

Can anyone please help me?


See More: .bat start random file

Report •

May 1, 2011 at 12:34:43
:: ==========================================
:: rpicker.bat Mon 02-05-2011 1:36:59.37
@echo off & setLocal enableDELAYedeXpansioN

set T=
for /f "tokens=* delims= " %%a in ('dir/b') do (
set /a T+=1
set /a S = !random! %% T + 1

set N=
for /f "tokens=* delims= " %%a in ('dir/b') do (
set /a N+=1
if !S! equ !N! (echo.pick: %%a & goto :eof)

Life is too important to be taken seriously.


Report •
Related Solutions

Ask Question