Start or stop a service by using the Net.exe feature that Windows brings
The command line format for the start/stop service is: NET Start/stop service Name (note: The service is set to the manual startup type first)
Example:
To start and stop the oracle11g service as an example (ORCL is the database name):
Copy Code code as follows:
% to start Oracle Services%
@echo. Service startup ...
@echo off
net start ORACLEVSSWRITERORCL
net start ORACLEDBCONSOLEORCL
net start Oracleoradb11g_home1tnslistener
net start ORACLESERVICEORCL
@echo, boot up!
@pause
% Service% of Oracle stop
Copy Code code as follows:
@echo. Service stop .....
@echo off
net stop ORACLEVSSWRITERORCL
net stop ORACLEDBCONSOLEORCL
net stop Oracleoradb11g_home1tnslistener
net stop ORACLESERVICEORCL
@echo. Service has stopped!
@pause
Startup method:
Method 1. After saving, you can start or close the service directly by double-clicking the file
Method 2. Setting Environment variables
In the system variable in the environment variable, add the path to the batch file after path, do not forget to use a semicolon, separate from the previous environment variable, and then enter the executable file directly in the run on the Start menu (the role of the environment variable is to tell the system where to enter information in the run).