How to delete all Windows Event logs at once

When troubleshooting Windows it’s often very helpful to start with clean log files. This shows you what’s happening with a system in the moment and you don’t waste time digging through log files and waiting for them to load.

To clear all Windows events from the logs, simply open an administrator-level command prompt and enter:

for /f %x in ('wevtutil el') do wevtutil cl "%x"

After a few moments all of the log files will be cleared.

Batch file use: If you’re using this in a batch file, you need to add an extra % sign to the variable names. Also, make sure you’re running the batch file as an administrator or you will get a lot of access denied messages. %x is valid on the command line only; it needs to be %%x in batch file. Here’s the updated code:

for /f %%x in ('wevtutil el') do wevtutil cl "%%x"

Thanks to stefan for bringing this up in the comments.




  1. #1 by Eugenijus on May 4, 2013 - 3:04 am

    Thanks, works perfect on windows7 x64

  2. #2 by bbbb on May 17, 2013 - 10:46 am

    Fantastic, thanks for the great tip.

  3. #3 by josephdietrich on June 28, 2013 - 8:27 am

    Very much a time saver in my particular case. Thanks for the tip.

  4. #4 by Great one tnx on July 17, 2013 - 2:21 pm

    ^^ “Dat name”

  5. #5 by Peter on September 22, 2013 - 5:38 am

    Works on WIndows 8.1 Professional x64

  6. #6 by stefan on December 23, 2013 - 7:46 pm

    great. now why wont this work when I save the one liner as a bat file? The command window appears and disappears rapidly when I right click on the bat file and ask it to run as admin. Even when I open a command window as admin and type in the name of the bat file I get nothing-just two prompts.
    but pasting the code works??

    • #7 by admin on December 23, 2013 - 9:02 pm

      Try it as a .cmd file?

      • #8 by stefan on December 24, 2013 - 11:41 am

        same result. a blip of a window then nothing happens.

        • #9 by admin on December 24, 2013 - 12:19 pm

          Code updated and tested. Should work fine now. Thanks for pointing it out!

  1. A way to clear event log files on Windows operating systems | The Underrated Blog