Clear All Event Logs in Event Viewer in Windows  

Page 10 of 11 FirstFirst ... 891011 LastLast

  1. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #90

    shiwan0804 said:
    Before:

    By the way, 存取被拒 means Access denied in English.
    Please you help me again. Thnaks a lot.
    Did you already test right clicking on the BAT file and clicking on "Run as administrator"?
      My Computers


  2. Posts : 79
    Windows 10 x64 21H1
       #91

    Brink said:
    Did you already test right clicking on the BAT file and clicking on "Run as administrator"?
    "Run as administrator" could clear event viewer logs successfully.
    But, double click couldn't let the BAT run goto noadmin.
      My Computer


  3. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #92

    shiwan0804 said:
    "Run as administrator" could clear event viewer logs successfully.
    But, double click couldn't let the BAT run goto noadmin.
    You'll need to use "Run as administrator" per the steps for it to successfully run.

    Something you have set is making the BAT think you are already elevated and not using "goto noadmin" when you just double click.
      My Computers


  4. Posts : 79
    Windows 10 x64 21H1
       #93

    Brink said:
    You'll need to use "Run as administrator" per the steps for it to successfully run.

    Something you have set is making the BAT think you are already elevated and not using "goto noadmin" when you just double click.
    I created a new "normal user" account just now.
    I double clicked the BAT, it still not run goto noadmin.

    That's OK. But it was funny that your test could appear goto noadmin.
    What difference of our OS?

    Thanks you a lot finally.
      My Computer


  5. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #94

    shiwan0804 said:
    I created a new "normal user" account just now.
    I double clicked the BAT, it still not run goto noadmin.

    That's OK. But it was funny that your test could appear goto noadmin.
    What difference of our OS?

    Thanks you a lot finally.
    I'm not sure other than different language possibly being an issue with the command.
      My Computers


  6. Posts : 79
    Windows 10 x64 21H1
       #95

    Brink said:
    I'm not sure other than different language possibly being an issue with the command.
    I changed the code since UTF-8 to ANSI.
    The BAT still not run goto noadmin.

    I downloaded and applied English US language pack of Windows 10.
    After I double clicked the BAT, the BAT ran goto noadmin finally.
    I was so sorry that I made you so busy.

    Finally, I wanted to said that I hated language pack bug.

    Best regards,
    Steven.
    Last edited by shiwan0804; 02 Jun 2021 at 22:28.
      My Computer


  7. Posts : 271
    Windows 10 Pro 64-bit (20H2) / Linux Mint 20 64-bit (Cinnamon)
       #96

    Will this work for Windows 11 users?

    Code:
    :: Created by: Shawn Brink
    :: Created on: August 15th 2016
    :: Updated on: July 25th 2018
    :: Tutorial: https://www.tenforums.com/tutorials/16588-clear-all-event-logs-event-viewer-windows.html
    
    
    @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 All Event Logs have been cleared!
    goto theEnd
    
    
    :do_clear
    echo clearing %1
    wevtutil.exe cl %1
    goto :eof
    
    
    :noAdmin
    echo Current user permissions to execute this .BAT file are inadequate.
    echo This .BAT file must be run with administrative privileges.
    echo Exit now, right click on this .BAT file, and select "Run as administrator".  
    pause >nul
    
    
    :theEnd
    Exit
      My Computer


  8. Posts : 61,561
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #97

    kuyenmotdivad said:
    Will this work for Windows 11 users?
    Hello,

    Yes, it should still work in Windows 11.
      My Computers


  9. Posts : 8
    Windows 10 Pro Build 10586
       #98

    BTW...I've been using this .bat utility for quite some time now. But I went a couple of steps further with the .bat file: I found "BAT to EXE Converter (64 Bit)" online, and converted it to a .exe file. Then I set the file's compatibility to "run as administrator". All I have to do do now is click it on my desktop and it runs. Hope this helps!
      My Computer


  10. Posts : 2,422
    Windows 10 Pro x64
       #99

    SeanBH said:
    BTW...I've been using this .bat utility for quite some time now. But I went a couple of steps further with the .bat file: I found "BAT to EXE Converter (64 Bit)" online, and converted it to a .exe file. Then I set the file's compatibility to "run as administrator". All I have to do do now is click it on my desktop and it runs. Hope this helps!
    Although a very handy utility, some antivirus programs, including Windows Defender, sometimes identify such .exe files as viruses and delete them!
    Have that in mind too!
    Last edited by ddelo; 4 Weeks Ago at 17:24.
      My Computer


 

Tutorial Categories

Clear All Event Logs in Event Viewer in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 15:52.
Find Us




Windows 10 Forums