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?