Code analysis of starting and stopping services using batch processing (net start & net stop)


Use windows native net.exe Function start or stop service
The command line format of start / stop service is: Net start / stop service name (Note: service should be set to manual start type first)
Take starting and stopping the Oracle11g service as an example (orcl is the database name):

Copy codeThe code is as follows:
%Start Oracle’s service%
@Echo. Service start
@echo off
net start OracleVssWriterORCL
net start OracleDBConsoleorcl
net start OracleOraDb11g_home1TNSListener
net start OracleServiceORCL
@Echo. Start up!

%Stop service% for Oracle

Copy codeThe code is as follows:
@Echo. Service stopping
@echo off
net stop OracleVssWriterORCL
net stop OracleDBConsoleorcl
net stop OracleOraDb11g_home1TNSListener
net stop OracleServiceORCL
@Echo. Service stopped!

Starting method:
Method 1. After saving, you can start or close the service directly by double clicking the file
Method 2. Set environment variables
In the system variable in the environment variable, add the path of batch file after the path, do not forget to use semicolon; separate it from the previous environment variable, and then directly input the executable corresponding file in the operation in the start menu (the role of environment variable is to tell the system where to input information in the operation)

Recommended Today

Apache sqoop

Source: dark horse big data 1.png From the standpoint of Apache, data flow can be divided into data import and export: Import: data import. RDBMS—–>Hadoop Export: data export. Hadoop—->RDBMS 1.2 sqoop installation The prerequisite for installing sqoop is that you already have a Java and Hadoop environment. Latest stable version: 1.4.6 Download the sqoop installation […]