Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Services can be stopped and started using two commands in Command Prompt Shell.

  1. net start service "some service"
  2. sc start "some service"

what is the difference between these commands?

share|improve this question

2 Answers 2

up vote 26 down vote accepted

In Windows NT, both commands access the same Service Manager. The difference is mainly in the user-visible part:

  • net is older – from the days of MS-DOS and OS/2, in fact.

    sc only appeared with Windows NT (not sure which version).

  • net can only start, stop and pause services.

    sc has more advanced controls, can query state, create and delete services, change their configuration and security: sc config beep start= demand

  • net only works locally.

    sc can be used over the network: sc \\snow start rpcapd

  • net accepts display names: net start "Windows Firewall"

    sc always requires a service name: sc start SharedAccess

share|improve this answer

Grawity's answer is certainly helpful, but I found a fundamental difference between these commands detailed on http://cbfive.com/blog/post/Command-Line-Service-Management-%28NET-v-SC%29.aspx . In particular, this page notes that these two commands differ in their timing: "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

share|improve this answer
    
An interesting detail, this one. Could be useful to know for scripting cases (%ERRORLEVEL% variable). Thanks. –  Sopalajo de Arrierez Mar 13 at 15:07
    
this answer is super helpful for me as I'm experiencing intermittent scripting errors trying to clean the service directory after stopping it since it's not fully stopped. –  johntrepreneur Sep 3 at 18:29
    
i want to use "sc config", is that asynchronous too? is there a way for a batch file to wait until the task is actually completed? –  peter Sep 16 at 8:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.