@ECHO OFF

DEL C:\LiveDigital\browse-tasks.txt
	
schtasks /query /FO TABLE /NH > C:\LiveDigital\browse-tasks.txt

FART.exe "C:\LiveDigital\browse-tasks.txt" "Folder: " " "
FART.exe -C "C:\LiveDigital\browse-tasks.txt" \\ " "
	
FOR /F "tokens=1,2,4,5 delims=_ " %%A IN (C:\LiveDigital\browse-tasks.txt) DO (
	IF "%%A"=="Browse" (
		Schtasks /Delete /tn "%%A_%%B" /f
		ECHO Deleting Task %%A_%%B
	)
)


set loopcount=5
:loop
set /a H=%random% * (23) / 32768
set /a M=%random% * (59) / 32768
set /a S=%random% * (59) / 32768
	
set H=0%H%
set H=%H:~-2%
set M=0%M%
set M=%M:~-2%
set S=0%S%
set S=%S:~-2%

set /a num=%random% %%%loopcount% + 1

if "%num%"=="1" (
	IF "%var_is64%"=="1" (
		schtasks /create /tn "Browse_%H%%M%%S%" /sd %var_startdate% /sc daily /st %H%:%M%:%S% /tr "C:\LiveDigital\hstart64.exe /NOCONSOLE /ELEVATE ""C:\LiveDigital\browse.bat""" /rl HIGHEST
	) ELSE (
		schtasks /create /tn "Browse_%H%%M%%S%" /sd %var_startdate% /sc daily /st %H%:%M%:%S% /tr "C:\LiveDigital\hstart.exe /NOCONSOLE /ELEVATE ""C:\LiveDigital\browse.bat""" /rl HIGHEST
	)
	@ECHO Task Created: Browse_%H%%M%%S%
)

set /a loopcount=loopcount-1
if %loopcount%==0 goto exitloop
goto loop
:exitloop

del C:\LiveDigital\browse-tasks.txt

EXIT