Jump to content

Restart service


nimexx
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

;)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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.

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
 Share

  • Recently Browsing   0 members

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