Register exe as a windows Service and exe as a windows Service

Source: Internet
Author: User

Register exe as a windows Service and exe as a windows Service

1. Tools Required

Instsrv.exe (you can install and delete services for the System)

Srvany.exe (allows programs to run as services)

2. Run cmd and enter the registration service command

"Instsrv.exe full path" "service name" "srvany.exe full path"

D: \ instsrv.exe ObjProjcet D: \ srvany.exe

3. open the registry, enter regedit in the shortcut window + r, and enter the Registry HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services. Right-click the service name (such as ObjProjcet) You just created and choose "Parameters ", click Select it and create a new string value named "Application" in the window on the right. The value is the path of the service to be run. The path must be a double slash "\\", then, you can create an AppDirectory to specify the initial directory for running the program (optional) in the same way as "Application", which is used to run the program directory. If this is not set, it is usually in disk C by default. If you need to make the service you have registered more professional and better understood, you can create a new string value named "Description ", you can enter the service description you want to display in the value.

4. Step 3 You can directly use the reg add command syntax of the cmd command. Note 3:

Reg add "HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ ObjProjcet \ Parameters"

Reg add HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ services \ ObjProjcet \ Parameters/v Application (AppDirectory)/t REG_SZ/d D: \ ObjProjcet \ Project.exe/f

Note:

1. New item, ObjProjcet (Service name) \ Parameters

2. Enter reg add /? View reg add Command help

3. reg add command syntax: reg add "item path to be added"/v "Value Name"/t "Data Type"/d "value"/f

4./v to specify the name;/t data type;/d to specify the content;/f to force work;

5. the/f parameter does not need to be confirmed. Sometimes the command is too long and may be a problem. you can use another method without the/f parameter. write echo y | reg add ***********

References:

1. How to register any exe program as a windows system service

2. How can I use the BAT file to automatically add a registry?


Related Article

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.