C # easily creates WinDOS services with bat files

Source: Internet
Author: User

Recently, a project needs a background service, timed to read the data, which is directly created a bat file, double-click on the execution can be, for the sake of trouble oh

The main points are two steps

1. Create the application for the Windows service. This does not do much to explain. There are too many examples on the web

2.bat file

Click on the project to add the class library, and then modify the. cs file to a. bat file to delete all contents.

Add the following content:

Create a service

SC create testservice binpath= "%cd%\testservice.exe"  start= autopause

Where TestService.exe is the generated EXE file for the service project

The red part, I vs2005,2008, this is OK. Inside the vs2013, you need to manually fill in the file path where the TestService.exe resides.

Delete Service

SC Delete  Testservice pause

  

C # easily creates WinDOS services with bat files

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.