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.
Example:
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
Example:
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.