@echo off
::设置服务名称
set service_name=ServiceManagement
::设置服务描述
set service_description=文件安全上传服务
::设置服务程序路径
set prog_path=%cd:\=\\%\\ServiceManagement.exe
::设置服务的启动方式 auto:自动 demand:手动 disabled:禁用
set strt=auto
echo EasyService 一键服务
echo ===========================================================
::pause
::======================以下部分勿随意修改==========================
set s32=%cd%\system32
set reg_file=EasyService.reg
net stop %service_name% 2>nul
copy instsrv.exe %s32%
copy srvany.exe %s32%
%s32%\instsrv.exe %service_name% remove 2>nul
%s32%\instsrv.exe %service_name% %s32%\srvany.exe >nul
::设置服务的启动方式 auto:自动 demand:手动 disabled:禁用
sc config %service_name% start= %strt%
sc description %service_name% "%service_description%"
echo 生成注册表文件...
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 导入注册表文件...
%reg_file%
net start %service_name%
echo ===========================完成============================
pause
保存为bat,将需要注册的程序和bat+instsrv.exe+srvany.exe放到同一个目录里边执行bat就可以
链接: https://pan.baidu.com/s/1pLdf7oJ 密码: ajmi