i2i8 Posted February 21, 2014 Share Posted February 21, 2014 Bat Script: @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 goto theEnd :do_clear echo clearing %1 wevtutil.exe cl %1 goto :eof :noAdmin exit Thank you! Link to comment Share on other sites More sharing options...
i2i8 Posted February 22, 2014 Author Share Posted February 22, 2014 I spent a long time trying to convert this BAT script AU3 script, but without success, so the teacher would like to ask you, how about this BAT script written by AU3? Link to comment Share on other sites More sharing options...
kylomas Posted February 22, 2014 Share Posted February 22, 2014 (edited) i2i8, A couple things: Your topic is about as non-descriptive as is possible. I last used BAT processing under MSDOS 5.0. It's changed quite a bit. I gather that you are trying to clear the event logs. A title like " Clearing Event Log Batch File Conversion" would have been better. Post what you've tried during this "long time". There are several eventlog functions that can easily do what you want. kylomas Edited February 22, 2014 by kylomas Fubarable 1 Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 23, 2014 Moderators Share Posted February 23, 2014 If you're looking to clear all event viewer logs on Windows 7, you can do something like this: ;Clear Event Viewer---------------------------------------- RunWait(@ComSpec & " /c wevtutil el > C:\logs.txt", @SystemDir, @SW_HIDE) $file = "C:\Logs.txt" Local $aLogs _FileReadToArray($file, $aLogs) _ArraySort($aLogs) For $i = 0 To UBound($aLogs) - 1 ShellExecute("wevtutil.exe", "cl " & $aLogs[$i], @SystemDir, "", @SW_HIDE) Next ShellExecute("wevtutil.exe", "cl System", @SystemDir, "", @SW_HIDE) Sleep(1000) FileDelete($file) ;-------------------------------------------------------------------- "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
FireFox Posted February 23, 2014 Share Posted February 23, 2014 I would like to know if someone still understand this syntax in 2K14 FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V Link to comment Share on other sites More sharing options...
kylomas Posted February 23, 2014 Share Posted February 23, 2014 @FireFox - Here is a good reference... Forum Rules Procedure for posting code "I like pigs. Dogs look up to us. Cats look down on us. Pigs treat us as equals." - Sir Winston Churchill Link to comment Share on other sites More sharing options...
FireFox Posted February 23, 2014 Share Posted February 23, 2014 (edited) Okay I understood it. I'm waiting for the OP to tell us what he's trying to achieve. Edited February 23, 2014 by FireFox Link to comment Share on other sites More sharing options...
i2i8 Posted March 7, 2014 Author Share Posted March 7, 2014 Very sorry, my dear friends!I've been busy, come back and reply to this thread until now.I just tried using the JLogan3o13 that script, but you can only clear the system log, other log cannot be cleared, for example: Application,Security,Setup,Forwarded Events. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 7, 2014 Moderators Share Posted March 7, 2014 That is untrue. If you read through the script you will find that it first creates an array of every log file on the machine (504 on my machine, put an _ArrayDisplay in the code to see it). It then loops through that array and clears each one of them. If this is not working for you, it may be a permissions issue. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now