@echo off
set @=q&set/an=0x53b7e0b4
title Any question +%@%%@% %n%
cd /d "%~dp0"
set "logfolder=D:\sk"
set "exefile=D:\test.exe"
set "record=记录.txt"
if not exist "%logfolder%" (echo;"%logfolder%" not found&pause&exit)
if not exist "%exefile%" (echo;"%exefile%" not found&pause&exit)
>"%tmp%\t.t" echo;WSH.echo DateDiff("n",CreateObject("Scripting.FileSystemObject").GetFile(WSH.Arguments(0)).DateLastModified,now)
cd.>"%record%"
for /f %%a in ("%exefile%") do set "exename=%%~nxa"
:loop
cls
for /f "delims=" %%a in ('dir /a-d /b /tw /o-d "%logfolder%\*.log"') do (set fname=%%a&goto break)
:break
if not defined fname (goto end)
echo;"%fname%"
for /f %%a in ('cscript -nologo -e:vbscript "%tmp%\t.t" "%logfolder%\%fname%"') do (
echo;[%%a]
if %%a geq 12 (
taskkill /f /im "%exename%" /t
start "" "%exefile%"
>>"%record%" echo;restart at %date% %time%
)
)
:end
echo;Any question +%@%%@% %n%
if exist "%windir%\System32\timeout.exe" (timeout /t 60 /nobreak) else (>nul ping /n 60 0)
goto loop