Skip to content

Instantly share code, notes, and snippets.

@zealfire
Created May 3, 2018 20:56
Show Gist options
  • Save zealfire/f27ec882ef242ebb49ed3b36249037eb to your computer and use it in GitHub Desktop.
Save zealfire/f27ec882ef242ebb49ed3b36249037eb to your computer and use it in GitHub Desktop.
"net" is synchronous and "sc" is asynchronous.
SC sends the control to the service and then returns to the command prompt. This typically results in SC START returning the service in a state of START_PENDING. NET START will wait for the service it is starting to come to a fully started state before it returns control at the command prompt.
...
[L]ike SC START, SC STOP does not wait for the service to come to a stop and will there for often return STOP_PENDING for many service stop operations. NET STOP on the other hand will wait on the service to stop before it returns to the command prompt.
...
NET and SC have different ideas of what they consider to be success conditions. The question SC asks to determine if it was successful is, “Did I successfully send a stop control to the service?” If it did, regardless of whether the service stopped, then I satisfied the successful condition. NET asks the question, “Did the service I attempted to stop, return that it stopped successfully?” If it did, then it satisfied the condition. If it didn’t, no matter what the reason, then NET fails the successful condition
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment