SC command-install, enable, configure, and Disable Windows Service bat batch processing

Source: Internet
Author: User

Not much nonsense. It's more straightforward to look at the command line!

1. directly use cmd to perform service operations

1. Install the service

 
SC create test3 binpath = "C: \ Users \ Administrator \ Desktop \ win32srvdemo \ win32srvdemo \ debug \ win32srvdemo.exe"

Test3 indicates the created Service name. The binpath is followed by the path where the EXE file is run.

2. Configure the service

There are the following centralized methods:

SC config service name start = auto  (Automatic)

SC config service name start = demand(Manual)

SC config service name start = disabled (disabled)

For example, the following command is automatically started when the host is enabled in the XP system:

 
SC config test3 start = auto

3. enable the Service

 
Net start test3

4. Close the service

 
Net stop test3

5. delete a service

 
SC Delete test3

2. For ease of use, you can edit it as a bat batch file.

(Create a new TXT file, name it yourself, and change the suffix to the. BAT file)

1. Create, configure, and enable services

 
@ Echo. service Startup ...... @ echo off @ SC create test3 binpath = "C: \ Users \ Administrator \ Desktop \ win32srvdemo \ win32srvdemo \ debug \ win32srvdemo.exe "@ Net start test3 @ SC config test3 start = auto @ echo off @ echo. started! @ Pause

2. Close the service

 
@ Echo. Close the service @ echo off @ net stop test3 @ echo off @ echo. Close the end! @ Pause

3. delete a service

@ Echo. Delete the service @ echo off @ SC Delete test3 @ echo off @ echo. The deletion is complete! @ Pause

Iii. SC

Can refer to a netizen's blog --- SC command management service status: http://blog.csdn.net/ddjj_1980/article/details/7493045

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.