安装服务
@echo off set checked=2
set PATHS=%~sdp0 echo 按任意键执行安装……?
pause>nul
if %checked% EQU 2 (
%PATHS%InstallUtil.exe %PATHS%WindowsService1.exe 2>&1
)else echo 未安装NET Framework
pause>nul
卸载服务
@echo off set checked=2
set PATHS=%~sdp0 echo 按任意键执行卸载……
pause>nul
if %checked% EQU 2 (
%PATHS%InstallUtil.exe /u %PATHS%WindowsService1.exe 2>&1
)else echo 卸载失败 pause>nul
启动服务
@echo off
net start 服务名称 2>&1
pause>nul
停止服务
@echo off
net stop 服务名称 2>&1
pause>nul