|
Answer» Code: [Select]echo off setlocal EnableDelayedExpansion
rem Set your path here: set "workDir=C:\Users\anto\test" rem PUSH to your path pushd "%workDir%" rem CREATE a vector with all files in your path set i=0 for %%f in (*.*) do ( set /A i+=1 set file!i!=%%f ) rem Remove a random file from the vector set /A rdNum=%random%*i/32768+1 set file%rdNum%= rem Remove a second random file from the vector (not the same) :remSecond set /A rdNum=%random%*i/32768+1 if not defined file%rdNum% goto remSecond set file%rdNum%=+ rem Remove a third random file from the vector (not the same) :remSecond set /A rdNum=%random%*i/32768+1 if not defined file%rdNum% goto remThird set file%rdNum%= rem Start the remaining files (all but THREE) for /L %%i in (1,1,+%i%) do if defined file%%i start "File %%i" !file%%i! rem Pop back to your path popd It works great opens all but 3 random files in the set folder but now i need it to do the same but set a short delay of about 150milisec between it opening each program
help me pleaseTry this in place of your third from BOTTOM line:
Code: [Select]for /L %%i in (1,1,+%i%) do ( if defined file%%i (start "File %%i" !file%%i!) PING 1.1.1.1 -n 1 -w 150 >nul ) The 150 is your milliseconds of wait time. Adjust there if you want to adjust the time.
|