I retrieved this interesting code from an older post ( link at end of text).
It works great.
I'm posting my question in a new thread because the original thread's so old.
If this is wrong let me know.
It's a long time since I looked at cmd line code and
would appreciate if someone could add brief comments to each line of the code to jog my memory
and help me understand the code structure and how it works.
Thanks

Older Forum Post
How To Clear Administrative Events Log - Event Viewer
It works great.
I'm posting my question in a new thread because the original thread's so old.
If this is wrong let me know.
It's a long time since I looked at cmd line code and
would appreciate if someone could add brief comments to each line of the code to jog my memory
and help me understand the code structure and how it works.
Thanks
Code:
@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 Event Logs have been cleared! ^<press any key^>
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo ^<press any key^>
:theEnd
pause>NUL
Older Forum Post
How To Clear Administrative Events Log - Event Viewer
My Computer
- OS
- Windows 7 64Bit