hl2guide

Clear All Event Logs - Batch for Windows 7

Jan 10th, 2015
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.36 KB | None | 0 0
  1. Save as clear_all_event_files.bat, Clears all Event Logs in Windows 7 or later:
  2.  
  3. @echo off
  4. FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V
  5. IF (%adminTest%)==(Access) goto noAdmin
  6. for /F "tokens=*" %%G in ('wevtutil.exe el') DO (call :do_clear "%%G")
  7. echo.
  8. echo goto theEnd
  9. :do_clear
  10. echo clearing %1
  11. wevtutil.exe cl %1
  12. goto :eof
  13. :noAdmin
  14. exit
Advertisement
Add Comment
Please, Sign In to add comment