Code analysis for starting and stopping services using batch implementation (NET Start&net stop) _dos/bat

Source: Internet
Author: User
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).

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.