将以下文字复制到txt文件中,更改后缀名为.bat,将此.bat文件放在服务的同级目录下。
1.安装服务:
@echo off
set filename=AIIMSService.exeset servicename=AIIMSTaskTimerpauseecho ============================操作日志==================================== >InstallService.log if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319" goto netOld :DispError echo 您的机器上没有安装 .net Framework 4.0,安装即将终止 echo 您的机器上没有安装 .net Framework 4.0,安装即将终止 >>InstallService.log goto LastEnd :netOld cd %SystemRoot%\Microsoft.NET\Framework\v4.0.30319echo 您的机器上安装了相应的.net Framework 4.0,可以安装本服务.echo 您的机器上安装了相应的.net Framework 4.0,可以安装本服务 >>InstallService.log echo off echo 清理原有服务项. . .%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil /U %filename% >> InstallService.logecho 清理完毕echo.echo *********************echo 安装服务%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil %filename% >> InstallService.logecho 启动服务net start %servicename% >> InstallService.logecho *********************echo ======================================================================= >>InstallService.log type InstallService.logecho.echo 操作结束,可以查看日志文件InstallService.log 中具体的操作结果。:LastEnd pauserem exit2.卸载服务
echo off
set filename=AIIMSService.exeset servicename=AIIMSTaskTimerecho ============================操作日志==================================== >UnInstallService.log if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319" goto netOld :DispError echo 您的机器上没有安装.net FrameWork 4.0,卸载即将终止 echo 您的机器上没有安装.net FrameWork 4.0,卸载即将终止 >>UnInstallService.log pause goto LastEnd :netOld echo 即将卸载本服务…echo off pause echo *********************echo 停止服务net stop %servicename% >>UnInstallService.log cd %SystemRoot%\Microsoft.NET\Framework\v4.0.30319%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil /uninstall %filename% >>UnInstallService.log echo 卸载服务echo ======================================================================= >>UnInstallService.log echo *********************type UnInstallService.log echo.echo 操作结束,可以查看日志文件UnInstallService.log中具体的操作结果。:LastEnd pause rem exit