Help Creating a Batch File

Discussion in 'other software & services' started by puff-m-d, Jun 19, 2014.

Thread Status:
Not open for further replies.
  1. puff-m-d

    puff-m-d Registered Member

    Joined:
    Feb 13, 2002
    Posts:
    5,703
    Location:
    North Carolina, USA
    Hello,

    First off, I have very little experience creating batch files and searching for a way to do what I want has yielded little results.

    Here is what I am trying to do. I need to open a elevated command prompt that will run this code:
    Code:
    for /f %x in ('wevtutil el') do wevtutil cl "%x"
    What this does is clear out all of your Event Viewer logs.
    I can manually open an elevated command prompt window, insert that code, hit enter, and it deletes all of the Event Viewer logs perfectly. I just cannot come up with a way to automate that so I just have a file or link that I just double-click and then that code will run...

    Anyone that can help me accomplish this, I will very much appreciate it.
     
  2. SweX

    SweX Registered Member

    Joined:
    Apr 21, 2007
    Posts:
    6,429
    Hey Kent,

    Not sure if this does the same as I have never tried.

    But CCleaner (if you have it installed) under advanced has an option called "Windows Event Logs" if you tick/enable that option and run CC maybe that will then clean them out. But as I said I have never tried that myself. :)
     
  3. puff-m-d

    puff-m-d Registered Member

    Joined:
    Feb 13, 2002
    Posts:
    5,703
    Location:
    North Carolina, USA
    Hello SweX,

    I have seen that option in CCleaner (it has been there for a while now I believe). On my system (Windows 8.1.1 Pro 64 bit), it has never found or deleted anything (using either "Analyze" or Run Cleaner"). It may work on others systems or Windows versions, but not here...
     
  4. SweX

    SweX Registered Member

    Joined:
    Apr 21, 2007
    Posts:
    6,429
    Right, then maybe it's supposed to clean out other logs than those, or it doesn't work correctly under Win 8. I don't know. :doubt:
     
  5. puff-m-d

    puff-m-d Registered Member

    Joined:
    Feb 13, 2002
    Posts:
    5,703
    Location:
    North Carolina, USA
    Yeah, I am not sure what it should find and clean but it always finds 0 files when I analyze and nothing shows in CCleaner logs if I clean. I can verify by opening Event Viewer and seeing all the logs are still there.

    I can do what is in my first post manually and all the Event Viewer logs are deleted. It is not a big deal doing it manually but when I have something like that I plan to use again, I try to create a batch file that will do the process automatically to simplify and automate the process.
     
  6. pegas

    pegas Registered Member

    Joined:
    May 22, 2008
    Posts:
    2,966
    How about winapp2.ini? It is more comprehensive in cleaning, check out this thread where is also a link to download this file.
     
  7. stapp

    stapp Global Moderator

    Joined:
    Jan 12, 2006
    Posts:
    24,119
    Location:
    UK
  8. puff-m-d

    puff-m-d Registered Member

    Joined:
    Feb 13, 2002
    Posts:
    5,703
    Location:
    North Carolina, USA
    Thanks pegas,

    I use that with CCleaner and update it often. I use most of the options when I clean (maybe about a dozen I do not use). AFAIK, there is no option for Windows Event Viewer Logs in winapp.2.ini (if there is I have never seen it). The few options I do not check are for specific reasons as they break something I want to keep so I know what I am not cleaning using that file.

    I have searched a lot on this subject and have not found many ways to delete all of this logs in one sweep. The method I posted is the easiest and best way to do so. Like I said, I can live with doing it manually but it would be great if I could figure out how to automate the process...
     
  9. puff-m-d

    puff-m-d Registered Member

    Joined:
    Feb 13, 2002
    Posts:
    5,703
    Location:
    North Carolina, USA
    Hello stapp,

    Thanks!

    You are my hero! I have searched and searched (obviously not in the right places or using good enough search terms) but never found that... That was exactly what I was l looking for!

    Thanks again!
     
Thread Status:
Not open for further replies.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.