Code Analysis for starting and stopping services using batch processing (net startnet stop)

Source: Internet
Author: User

Use the net.exe function provided by windows to start or stop services
The command line format for starting/stopping a service is: net start/stop service name (note: the service must be set to manual start first)
Example:
Take starting and stopping the Oracle11g service as an example (ORCL is the database name ): Copy codeThe Code is as follows: % start Oracle service %
@ Echo. Start the service ......
@ Echo off
Net start variable levsswriterorcl
Net start OracleDBConsoleorcl
Net start OracleOraDb11g_home1TNSListener
Net start OracleServiceORCL
@ Echo. started!
@ Pause

% Stop Oracle services %Copy codeThe Code is as follows: @ echo. The service is stopping .....
@ Echo off
Net stop OracleVssWriterORCL
Net stop OracleDBConsoleorcl
Net stop OracleOraDb11g_home1TNSListener
Net stop OracleServiceORCL
@ Echo. The service is stopped!
@ Pause

Start 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 (the environment variable is used to tell the system where information is entered during running)

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.