Registering an EXE as a Windows service instance tutorial

Source: Internet
Author: User
1. Tools Required

Instsrv.exe (can provide system installation and removal services)

Srvany.exe (can let the program run as a service)

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, shortcut window + R, enter regedit, enter the registry HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services, the name of the service you just created (e.g. OBJPROJCET) Right-new item "Parameters", click to select it and then in the right window create a new string value named "Application", the value is the path of the service you want to run, the path needs a double slash "\ \", You can then set up a appdirectory to specify the program to run the initial directory (optional) to establish the same way as "application", this is used to do the program run directory, do not set the general default in the C drive. If you need to make your registered service look more professional and better understand, you can continue to create a new string value named "Description", in which you can enter the description of the service you want to display.

4. Step 3 can be directly through the cmd command of the REG ADD command syntax 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 reg ADD "the Item path to add"/V "Value name"/T "data type"/d "value"/F

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

5./f parameter is not necessary to confirm the meaning of forced modification, sometimes the command is too long may be a bit problematic. You can do this in a different way without the/F parameter. Write this: Echo y|reg add ***********

Resources:

1. How to register any EXE program as a Windows system service

2. How do I write with the bat file to automatically add the 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.