Answered by:
Deleting Log Files Safely

Question
-
I've used this batch file for years in Windows 7, with no ill effect.
I thought I would ask if it is safe to run it in WDP also.
It simply clears all of the logs in Windows.
I like to boot with a empty slate and then check to see what happened during the session
without combing though a week or more of logs.
Here is the 'code?'
@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 Event Logs have been cleared! ^<press any key^>
goto theEnd
:do_clear
echo clearing %1
wevtutil.exe cl %1
goto :eof
:noAdmin
echo You must run this script as an Administrator!
echo ^<press any key^>
:theEnd
pause>NULMonday, January 30, 2012 10:15 PM
Answers
-
I ran the batch file. There were no errors and it seemed to work quite well.
- Marked as answer by windunce Wednesday, February 1, 2012 12:02 AM
Tuesday, January 31, 2012 11:55 PM
All replies
-
Hello windunce,
Do you get an error message when you try to run the script?
If so, please provide the error message here.
Thanks,
MarilynTuesday, January 31, 2012 7:49 PMModerator -
Hello windunce,
Do you get an error message when you try to run the script?
If so, please provide the error message here.
Thanks,
Marilyn
No, I have yet to run the batch file.I was 'afraid?' that I might screw something up.
But I guess I will try it anyway. For something is once again screwed up.
The screw up is as follows.
Twice now I have chosen to change to making Windows 7 as the default OS
from the Metro/WDP blue dual-boot screen options.
Each time, upon re-boot, I am greeted with the old style black boot-manager.
Then upon refreshing I am back to the blue WDP boot screen, but for this next
refresh, I will be quite aware of what folders to save so that getting my tweaks
back will be quite a bit quicker!
What seems just a bit strange to me is that it 'seems?' as if WDP loads 99% of
the OS just to get to that blue dual-boot screen, for when i choose to open
WDP as the OS I arrive at the Log-On screen nearly instantaneously.
Whereas if I choose to boot to Win7 from the blue bootmanager, the computer actually
shuts down and restarts and then loads the Win7 boot loader program to proceed to Win7 logon.
I am now in Win7. I will reboot and load WDP, run the batch file and then edit this post
and report if there where any errors while running it.
Thanks
Windunce
ps...I finally got that left-edge program 'pop out' to work with my mouse. Nice!
Tuesday, January 31, 2012 11:20 PM -
I ran the batch file. There were no errors and it seemed to work quite well.
- Marked as answer by windunce Wednesday, February 1, 2012 12:02 AM
Tuesday, January 31, 2012 11:55 PM