@echo off
:: Set Service Name
Set Service_name=servicemanagement
:: Set Service description
Set service_description= file Security upload Service
:: Set the service program path
Set Prog_path=%cd:\=\\%\\servicemanagement.exe
:: Set startup mode for service Auto: Auto demand: Manual disabled: Disable
Set Strt=auto
echo Easyservice One-click Service
Echo ===========================================================
::p ause
:: ====================== The following parts do not modify ==========================
Set S32=%cd%\system32
Set Reg_file=easyservice.reg
net stop%service_name% 2>nulcopy instsrv.exe%s32%
Copy Srvany.exe%s32%
%s32%\instsrv.exe%service_name% Remove 2>nul
%s32%\instsrv.exe%service_name%%s32%\srvany.exe >nul
:: Set startup mode for service Auto: Auto demand: Manual disabled: Disable
sc config%service_name% start=%strt%
SC description%service_name% "%service_description%"
Echo generates the registry file ...
echo Windows Registry Editor Version 5.00 >%reg_file%
echo [Hkey_local_machine\system\currentcontrolset\services\%service_name%\parameters] >>%reg_file%
echo "Application" = "%prog_path%" >>%reg_file%
Echo Import Registry File ...
%reg_file%
net start%service_name%
echo =========================== Complete ============================
Pause is saved as bat, and the programs and bat+instsrv.exe+srvany.exe that need to be registered are placed in the same directory and executed bat can be linked: Https://pan.baidu.com/s/1pLdf7oJ password: Ajmi
Registering a Windows application as a Windows service