Windows Guides Feed

clip image001 Clear the Event Viewer in Windows 7 [How To]Are you a regular user of the Event Viewer in Windows 7? Ever wonder why Microsoft haven’t programmed it to clear itself after a certain amount of entries or time?

As it stands right now, I have tens of thousands of entries in the Event Viewer which is unnecessary and bogs down the loading time. Maybe for a corporate administrator this is required but for average Joe, it isn’t.

What is the Event Viewer?

“Windows NT has featured event logs since its original release in 1993. Applications and operating system components can make use of this centralized log service to report events that have taken place, such as a failure to start a component or complete an action. The system defines three log sources:

  • “System”
  • “Application”
  • “Security”

Microsoft intends the System and Application log sources for use by the Windows operating system and Windows applications respectively. Only the Local Security Authority Subsystem Service (lsass.exe) can directly write to the Security log.”

With that out of the way, on with the guide to show you how to clear the Event Viewer.

Step 1.

Click the Start Menu and type notepad.  Click on Notepad from the results.
clip image002 Clear the Event Viewer in Windows 7 [How To]

Step 2.

In Notepad, copy and paste the entirety of this text file. Make sure that the top line reads “@echo” and the bottom line reads “exit” (both without quotation marks).
Once it’s all in there, go to File > Save As…
Make sure that under Save as type; All Files (*.*) is selected.
Name the file, Clear Event Viewer.bat and click Save.clip image003 Clear the Event Viewer in Windows 7 [How To]

clip image004 Clear the Event Viewer in Windows 7 [How To]

Your new file should now look like this:

clip image005 Clear the Event Viewer in Windows 7 [How To]
If it doesn’t and it looks like this:
clip image006 Clear the Event Viewer in Windows 7 [How To]

Go back and try again.

Step 3.

Find the batch file we created a second ago and double click it.  The command prompt window will now pop-up and run through the batch file commands.  Let it finish and it will automatically close.

clip image007 Clear the Event Viewer in Windows 7 [How To]

Now you can go ahead and open up the Event Viewer and have a completely clear view!

Alternatively, you can download the batch file here and run it in the same way.



Free PC tips by email

Search Windows Guides




Comments

  • Kouman Ο Μάστορας

    Thanks!!! :-)

  • Kouman Ο Μάστορας

    Thanks!!! :-)

  • Kouman Ο Μάστορας

    Thanks!!! :-)

  • Lost One

    Thanks for your batch file!
    I found another script that clears every single log file:
    http://www.wilderssecurity.com/showpost.php?s=39f67ac9ade8cf585d0c8e0b0e411999&p=1613265&postcount=8

    @echo off
    for /F “tokens=1,2*” %%V IN (‘bcdedit’) DO SET adminTest=%%V
    if (%adminTest%)==(Access) goto noAdmin
    echo Clearing all Eventlogs
    echo Please Wait…
    for /F “tokens=*” %%G in (‘wevtutil.exe el’) DO (call :do_clear “%%G”)
    echo.
    echo Event Logs have been cleared!
    goto theEnd
    :do_clear
    ::echo clearing %1
    wevtutil.exe cl %1
    goto :eof

    :noAdmin
    echo You must run this script as an Administrator!

    :theEnd
    echo.
    echo Press any key to exit
    pause>nul

  • Lost One

    Thanks for your batch file!
    I found another script that clears every single log file:
    http://www.wilderssecurity.com/showpost.php?s=39f67ac9ade8cf585d0c8e0b0e411999&p=1613265&postcount=8

    @echo off
    for /F “tokens=1,2*” %%V IN (‘bcdedit’) DO SET adminTest=%%V
    if (%adminTest%)==(Access) goto noAdmin
    echo Clearing all Eventlogs
    echo Please Wait…
    for /F “tokens=*” %%G in (‘wevtutil.exe el’) DO (call :do_clear “%%G”)
    echo.
    echo Event Logs have been cleared!
    goto theEnd
    :do_clear
    ::echo clearing %1
    wevtutil.exe cl %1
    goto :eof

    :noAdmin
    echo You must run this script as an Administrator!

    :theEnd
    echo.
    echo Press any key to exit
    pause>nul

  • Lost One

    Thanks for your batch file!
    I found another script that clears every single log file:
    http://www.wilderssecurity.com/showpost.php?s=39f67ac9ade8cf585d0c8e0b0e411999&p=1613265&postcount=8

    @echo off
    for /F “tokens=1,2*” %%V IN (‘bcdedit’) DO SET adminTest=%%V
    if (%adminTest%)==(Access) goto noAdmin
    echo Clearing all Eventlogs
    echo Please Wait…
    for /F “tokens=*” %%G in (‘wevtutil.exe el’) DO (call :do_clear “%%G”)
    echo.
    echo Event Logs have been cleared!
    goto theEnd
    :do_clear
    ::echo clearing %1
    wevtutil.exe cl %1
    goto :eof

    :noAdmin
    echo You must run this script as an Administrator!

    :theEnd
    echo.
    echo Press any key to exit
    pause>nul

  • A N Egorenkov

    simple way type in cmd:
    for /F “tokens=*” %1 in (‘wevtutil.exe el’) DO (wevtutil.exe cl “%1″)

  • Dejesusr147

    Helps alot… Thank UUUUUUUUUUUUUUU

  • Skiperr42

    Greatly appreciated I got the same call repeatedly

  • Jer8945hen

    Works great but I found out that I had to right click on the Clear Event Viewer.bat file and run as administrator for it to clear the entries 

  • OBAMA_CAN_SUCK_IT

    M$ IS RETARDED! WHY MUST YOU DO ALL OF THIS JUST TO CLEAR IT? WHY CAN’T THEY JUST HAVE A CLEAR ALL LOGS OPTION LIKE XP HAS?! MORONS!


Computer tips in your inbox
Sign up for the Windows Guides newsletter to get PC tips and access to free Windows books (More details)

Enter your email address:
 

Popular Guides

See which sites have been visited on your PC (even if private browsing mode is used)

Create a Windows 7 System Repair Disc

Best Free Anti-malware

Hibernate vs. Sleep vs. Shut-Down

i3, i5, and i7; Dual, Quad, Hexa Core Processors. How to they Differ?

Intel's Ivy Bridge Processor: new Features

Submit Your Tip
Submit your computer tip to us; receive full credit for all published tips

Windows Guides on Facebook