So i got this batch file that removes logs from the event viewer. Here's the code right here:
@echo off
FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
IF (%adminTest%)==(Access) goto noAdmin
for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
echo.
echo goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
exit
P.S. You need to run it as administrator to get it to work.
But I don't know how to make it only delete logs from a timed interval. Specifically speaking from 12am to 9am. I've searched up a lot of date and time info on batches but it didnt help much. I'm used to C and Java and all I really need is kind of an if-statement that clears the log if its between that interval. I'm so confused!
Thank You
Btw I have Windows 7 if that helps at all
Bookmarks