Jump to content

Start /wait Command Question


hatred

Recommended Posts

im makeing a bat file thats shuts down a whole bunch of services ive listed and would like to know if you use start sc stop wuauserv would it be like this. start /wait sc stop wuauserv or start sc stop wuauserv /wait ???

Link to comment
Share on other sites


Using the SC command in a cmd file you can do it pretty neatly like this:

@ECHO OFF
SETLOCAL
SET NoGo=Alerter Browser CiSvc ClipSrv ERSvc HidServ lanmanserver LmHosts Messenger mnmsrvc NetDDE NetDDEdsdm Netlogon Nla RDSessMgr RemoteAccess RSVP SCardSvr seclogon srservice SSDPSRV SysmonLog upnphost UPS W32Time WebClient WmdmPmSN WmiApSrv wscsvc WZCSVC Xmlprov
FOR %%s IN (%NoGo%) DO SC query %%s | FIND /i "RUNNING"
IF ERRORLEVEL 0 SC stop %%s
ENDLOCAL
EXIT

This should check if each of the thirty one example services in the space separated list is running and if it is stop it!

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...