Use the batch processing for command to clear all Windows EventLog logs of Event Viewer

Source: Internet
Author: User

Previously, after installing the system, you had to create a Ghost. To achieve perfection, all Windows EventLog logs of the Event Viewer will be manually cleared before each Ghost operation.

Later, after using Windows 2008 r2/Win7, this incident was much more complicated, so it was no longer necessary.
Later, some colleagues asked how to clear all of them, because one by one, there are many directories at the Microsoft level. To completely clear them for half an hour, and then there is another directory after they are cleared, it is not practical.

Today, when I was playing with Hyper-V, I always saw a bunch of errors. In view of the continuous delivery that I made to the company, batch processing was very good, therefore, we thought we could use batch processing. After Google found that an international friend mentioned the method of clearing all Win7 eventlogs and wrote a screen of CMD, which was easy to understand, you have to clear all Windows eventlogs in this row.

In principle, this method can be used in all Windows systems, but I only pass the test on Windows 2008 R2, so at least Vista and later versions can be used.

Save as WindowsEventLog. ClearAll. cmd and double-click it:

Copy codeThe Code is as follows: @ ECHO OFF
TITLE: Clear EventLog logs in all Event Viewer

ECHO.
ECHO CreateBy Liuyong fa 12:05:30
ECHO ModifyBy Liu yongfa 18:10:55
ECHO.

FOR/F "delims =" % I in ('wevtutil EL ') DO (wevtutil cl "% I ")
PAUSE

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.