WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Services

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

wntSvcStatus Example

Keywords: 	 wntSvcStatus

Here's an example to change the service from automatic to disabled.

Note. After using the wntSvcControl function to stop a service, you must use wntSvcStatus to wait for it to stop before attempting to do anything.


;How to stop a service an wait for it to completely stop
AddExtender("wwwnt34i.dll")
aService="Spooler"
state = wntSvcStatus("", aService, 0, 2) ; get the current state of the service
If state==4 ; service is running
        ; stop the service now
        wntSvcControl("", aService, 0, 1) ; stop the Service
endif

;wait for service to stop
While State ! = 1
   TimeDelay(1)
	state = wntSvcStatus("", aService, 0, 2) ; get the current state of the service 
Endif

Message(aService,"Stopped completely")


Article ID:   W13581
Filename:   wntSvcStatus Example.txt
File Created: 2001:10:11:13:10:36
Last Updated: 2001:10:11:13:10:36