Skip to content

Instantly share code, notes, and snippets.

@joshz
Created May 29, 2011 11:38
Show Gist options
  • Save joshz/997677 to your computer and use it in GitHub Desktop.
Save joshz/997677 to your computer and use it in GitHub Desktop.
clean logs win 7
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment