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.