hey guys, back after 3 years

Code: Select all
@echo off
pushd "C:\Ruzne\Red Dwarf\"
dir "*.avi" /a-d /b >"%temp%\tmp.tmp"
for /f %%a in ('find /c /v "" ^< "%temp%\tmp.tmp"') do set lines=%%a
set /a rand=%RANDOM% %% %lines%
if [%rand%]==[0] (set var=) else (set var=skip=%rand%)
for /f "%var% tokens=*" %%a in ('type "%temp%\tmp.tmp"') do (
set "text=%%a"
goto :continue
)
:continue
set /a line=rand+1
:: echo line %line% of %lines% : "%text%"
start "" "%text%
shutdown -s -t 1800 -f
so ive been using this past 3 years, all worked fine...
but just last night i fresh installed win7 again (as i was doing several times in those 3 years) all updates are up as usual...
but cant understand the reason, the code doesnt work anymore...
once u run it... its trying to run all files from the directory again and again...
when i just try to
Code: Select all
echo line %line% of %lines% : "%text%"
dos window keeps listing names of all files in the directory in random order (not just each file once, but in a random loop all over and over again)
so how do i stop the loop once it find a random file from that?
thanks for reply