Jump to content
Sign in to follow this  
i2i8

Bat convert Au3

Recommended Posts

i2i8

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!

Share this post


Link to post
Share on other sites
i2i8

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?

Share this post


Link to post
Share on other sites
kylomas

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 by kylomas
  • Like 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

Share this post


Link to post
Share on other sites
JLogan3o13

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)
;--------------------------------------------------------------------

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
FireFox

I would like to know if someone still understand this syntax in 2K14  :puke:

FOR /F "tokens=1,2*" %%V IN ('bcdedit') DO SET adminTest=%%V

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
kylomas

@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

Share this post


Link to post
Share on other sites
FireFox

Okay I understood it.

I'm waiting for the OP to tell us what he's trying to achieve.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites
i2i8

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.

Share this post


Link to post
Share on other sites
JLogan3o13

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.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.