Enable or disable Windows Services with Batch Processing

Source: Internet
Author: User
One worker uses the SC .exe command:
1. Change the service startup status.
2. Delete the Service (otherwise, it is not recommended to delete any system service, especially the basic service with caution)
3. Stop or start the service (the function is similar to net stop/start, but more services are faster and can be stopped)
Specific command format:
Modify the command line format of the Service Startup type to (note that START = is followed by a space)
SC config service name start = demand (set service to manual start)
SC config service name start = disabled (set service to disabled)
The command line format for stopping/starting a service is
SC stop/start service name
Note: The service name can be queried by double-clicking the corresponding service display name in the control panel> Administrative Tools> service.
Set Remote Registry Service to manual format
SC config RemoteRegistry start = demand
Set the disabled format
SC config RemoteRegistry start = disabled
When the service is stopped, the format is
SC stop RemoteRegistry

Ii. Use the net.exe function to start or stop the service
The command line format for starting/stopping a service is
Net start/stop service name
Take starting and stopping the Oracle service as an example: Because the Oracle service occupies a lot of system resources and does not usually use the Oracle database. So I set it to manual start, and each time I use Oracle, I use batch processing to start a bunch of services.
-- Start Oracle services
@ Echo off
Net start oraclemtsrecoveryservice
Net start oracleorahome92agent
Net start oracleorahome92tnslistener
Net start oracleservice Database Name
-- Stop Oracle services
@ Echo off
Net stop oracleservice Database Name
Net stop oracleorahome92tnslistener
Net stop oracleorahome92agent
Net stop oraclemtsrecoveryservice

Iii. startup method:
Method 1. After saving the file, you can directly double-click the file to start or close the service.
Method 2. Set Environment Variables
In the system variables in the environment variables, add the path of the batch file after the path. Do not forget to use a semicolon; separate it from the previous environment variables, then, enter the executable file directly in the running of the Start Menu.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.