SC command (Windows service on/off)

Source: Internet
Author: User

sc.exe command Feature List:

1. Change the startup status of the service (this is a more practical feature)

2. Delete a service (unless you have a clearer picture of the software and hardware required for your PC, it is not recommended to remove any system services, especially basic services)

3. Stop or start the service (functionally similar to net Stop/start, but much faster and can stop the service many others)

The detailed command format is as follows:

Change the command line format for the service startup type (especially note that there is a space behind start=)

 SC config Service name start= demand (set service to start manually)

sc config service name start= disabled (set service to Disabled)

The command-line format for the stop/start service is

SC Stop/start Service Name

Note: Usually contact is the display name of the service, and the above refers to the service name, can be in the Control Panel, management tools, services. Double-click the appropriate service to query.

  

Let's start with an example of how to set it up in detail:

If you set the remote Register service to manual format for

sc config RemoteRegistry start= demand

The formats that are set to Disabled are:

sc config remoteregistry start= disabled

Stop service The format is:

sc stop RemoteRegistry

Start by checking the name of the service you want to set. Batch files are made according to the format above. Once the system is re-installed, it is only possible to execute batch files.

Here are my settings, based on XPSP2, can be compared to the system used to delete and modify.

Note: No increase in XPSP2 's own active update, Security Center, firewall.

sc config Alerter start= demand

sc config Trkwks start= demand

sc config helpsvc start= demand

sc config PolicyAgent start= demand

sc config Dmserver start= demand

sc config wmdmpmsn start= demand

sc config Spooler start= demand

sc config RemoteRegistry start= demand

sc config ntmssvc start= demand

sc config Seclogon start= demand

sc config Schedule start= demand

sc config WebClient start= demand

sc config W32Time start= demand

sc config WZCSVC start= demand

sc config ersvc start= demand

sc config Themes start= demand

sc config fastuserswitchingcompatibility start= disabled

sc config Messenger start= disabled

sc config protectedstorage start= disabled

sc config ssdpsrv start= disabled

sc config TermService start= disabled

sc config shellhwdetection start= disabled

If you need to close the service immediately, you can follow the code below

sc stop W32Time

sc stop ShellHWDetection

sc stop Trkwks

sc stop helpsvc

sc stop Dmserver

sc stop PolicyAgent

sc stop Spooler

sc stop remoteregistry; remote Change Register

sc stop Seclogon

sc stop Schedule

sc stop WZCSVC

sc stop Ersvc

sc stop Themes

sc stop fastuserswitchingcompatibility

sc stop ProtectedStorage

sc stop SSDPSRV

sc stop WebClient

Finally, the changed code is saved as Services.cmd, and later when the service is set up. Direct execution of pre-saved batch files can be done with less effort.

See here, the use of Win2000 friends do not have to be disappointed,Sc.exeThis command-line tool is the same for Win2000 and can be copied from a machine equipped with WinXP or Win2003Sc.exeFile, put it together with the saved batch file, and then run the batch file.

A friend who is more familiar with the register may think of using a register to set the startup type of the service, which is a viable approach, but inherently inadequate. This is due to the fact that the service startup type has a long and dispersed key value in the registration form and is easy to collate and error-prone, so this method is more suitable for unattended installations.

SC command (Windows service on/off)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.