Sign in to follow this  
Followers 0
nimexx

Restart service

4 posts in this topic

Okay, bit of a dumb question here but how can I stop and start a service?

I know I could use Processclose but Im not sure that is the same thing as using doing a net stop on a service.

I can run something with Run but does an exe regeistered as a service have to be started differently then just running the exe? Would running an exe be the same thing as doing a net start on that process?

Is there some other way to stop and start a service rather then doing this?

RunWait(@ComSpec & " /c net stop abc")

RunWait(@ComSpec & " /c net start abc")

I think this would cause the dos window to flash by and if I use the swhide setting Im afraid the one of those could get hung up and hang the script. I need to do stuff in between these events so I cant really use Run instead of RunWait.

Any ideas?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I think this would cause the dos window to flash by and if I use the swhide setting Im afraid the one of those could get hung up and hang the script. I need to do stuff in between these events so I cant really use Run instead of RunWait.

Any ideas?

Welcome,

Look at the forum stickie posts.

Services management has been mentioned thoughly in the past so search should also reap other alternatives.

;)

Edited by MHz

Share this post


Link to post
Share on other sites

Okay, bit of a dumb question here but how can I stop and start a service?

I know I could use Processclose but Im not sure that is the same thing as using doing a net stop on a service.

I can run something with Run but does an exe regeistered as a service have to be started differently then just running the exe? Would running an exe be the same thing as doing a net start on that process?

Is there some other way to stop and start a service rather then doing this?

RunWait(@ComSpec & " /c net stop abc")

RunWait(@ComSpec & " /c net start abc")

I think this would cause the dos window to flash by and if I use the swhide setting Im afraid the one of those could get hung up and hang the script. I need to do stuff in between these events so I cant really use Run instead of RunWait.

Any ideas?

Not sure what is wrong with doing the Net Stop and Start. Just add the correct parameter on the Run() command to @sw_hide it and test for a given time for its completion......... but there is an Include file flooting around in the Examples forum that has all service functions as UDF's ... they work quite nice ...

;)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Welcome,

Look at the forum stickie posts.

Services management has been mentioned thoughly in the past so search should also reap other alternatives.

;)

Thanks, I had searched the forums but was getting many posts about creating scripts that run as services rather then info on restarting an existing service. The stickie posts had my answer.

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  
Followers 0