Jump to content

How to Start or Stop Windows Services


Recommended Posts

Hi Everyone,

As the title stated, I want to run a script to stop certain Windows Services and then Start them again. Is there a command to do this? Can someone provide me an example or shine some light on me? I know there's a way to do it using Batch File, but if I can write it in AutoIT, I rather do it that way since it's cooler looking than the black dos screen.

Greatly appreciated.

Dreamzboy :)

Link to comment
Share on other sites

Net Start:

http://www.microsoft.com/resources/documen...t.mspx?mfr=true

Net Stop:

http://www.microsoft.com/resources/documen...p.mspx?mfr=true

;Return code
;0 = Success
;2 = Already Stopped / Started

$result = RunWait(@ComSpec & " /c net stop server", @ScriptDir, @SW_HIDE)

MsgBox(0,"",$result)

$result = RunWait(@ComSpec & " /c net start server", @ScriptDir, @SW_HIDE)

MsgBox(0,"",$result)
Link to comment
Share on other sites

Net Start:

http://www.microsoft.com/resources/documen...t.mspx?mfr=true

Net Stop:

http://www.microsoft.com/resources/documen...p.mspx?mfr=true

;Return code
;0 = Success
;2 = Already Stopped / Started

$result = RunWait(@ComSpec & " /c net stop server", @ScriptDir, @SW_HIDE)

MsgBox(0,"",$result)

$result = RunWait(@ComSpec & " /c net start server", @ScriptDir, @SW_HIDE)

MsgBox(0,"",$result)oÝ÷ Ûú®¢×¦ñRȧ*.­Êx¨v'âyØ­¶®¶­scµ&WGW&â6öFP£³Ò7V66W70£³"ÒÇ&VG7F÷VBò7F'FV@ ¢b33c·&W7VÇBÒ'VåvB6öÕ7V2fײgV÷C²ö2æWB7F÷v&VÆW72¦W&ò6öæfwW&FöâgV÷C²Â67&DF"Â5uôDR ¤×6t&÷ÂgV÷C²gV÷C²Âb33c·&W7VÇB ¢b33c·&W7VÇBÒ'VåvB6öÕ7V2fײgV÷C²ö2æWB7F'Bv&VÆW72¦W&ò6öæfwW&FöâgV÷C²Â67&DF"Â5uôDR ¤×6t&÷ÂgV÷C²gV÷C²Âb33c·&W7VÇB

The message box showed up with the value 1 for result, but it did not stop the service. I'm not sure if I modified it correctly, can you justify?

Thanks,

Dreamzboy

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