Jump to content

Looking for a way to automate a cmd command and make it silent


Recommended Posts

Hi

I am looking for a way to silent run (without pop up of shell window) this command (to clean all windows event logs) from cmd if it is possible :

for /f %x in ('wevtutil el') do wevtutil cl "%x"

or from a bat file using this one that works but invisible again:

for /f %%x in ('wevtutil el') do wevtutil cl "%%x"

Thanks

Edited by Pamamolf
Link to comment
Share on other sites


You need to use a "third party" tool capable of hiding the command window, these could range from a "simpler, hide only" tool, like cmdow or similar:
http://www.commandline.co.uk/cmdow/

up to a "general helper" such as Nircmd:

http://nircmd.nirsoft.net/exec.html

You'll most probably need to deal with the UAC/Administrator prompt, however.

jaclaz
 

Link to comment
Share on other sites

You can use a VBS script to not show any windows 

Example

'-> Constants For The Various Window States
Const Hide = 0, Norm = 1, Min = 2, Max =3 
'-> Object For Runtime
Dim Act :Set Act = CreateObject("Wscript.Shell")
'-> Hidden Window And No Wait For The Script
 Act.Run("%comspec% /C @Echo Off && CLS && Echo. && Echo Test &&  ping -n 3 127.0.0.1>nul"),0,False
'-> Show The Normal Window And Wait For The Script To Finish
' Act.Run("%comspec% /C @Echo Off && CLS && Echo. && Echo Test &&  ping -n 3 127.0.0.1>nul"),1,True 
Link to comment
Share on other sites

Confused on how to edit this vbs with the two commands that i want to use:

for /f %x in ('wevtutil el') do wevtutil cl "%x"
vssadmin delete shadows /for=c: /all /quiet

Also is it possible to enable admin rights with it but quiet without any prompt or visible window?

Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...