@echo offset filename=E:\WinService\bin\Debug\CiWong.Account.Client.WinService.exeset servicename=AccountService //服务名pauseecho ============================操作日志==================================== >InstallService.log if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319" goto netOld:DispErrorecho 您的机器上没有安装 .net Framework 4.0,安装即将终止echo 您的机器上没有安装 .net Framework 4.0,安装即将终止 >>InstallService.log goto LastEnd:netOldcd %SystemRoot%\Microsoft.NET\Framework\v4.0.30319echo 您的机器上安装了相应的.net Framework 4.0,可以安装本服务.echo 您的机器上安装了相应的.net Framework 4.0,可以安装本服务 >>InstallService.log echo offecho 清理原有服务项. . .%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.logtype InstallService.logecho.echo 操作结束,可以查看日志文件InstallService.log 中具体的操作结果。:LastEndpauserem exit
卸载:
echo offset filename=E:\WinService\bin\Debug\CiWong.Account.Client.WinService.exeset servicename=AccountServiceecho ============================操作日志==================================== >UnInstallService.log if exist "%SystemRoot%\Microsoft.NET\Framework\v4.0.30319" goto netOld:DispErrorecho 您的机器上没有安装.net FrameWork 4.0,卸载即将终止echo 您的机器上没有安装.net FrameWork 4.0,卸载即将终止 >>UnInstallService.log pausegoto LastEnd:netOldecho 即将卸载本服务…echo offpauseecho *********************echo 停止服务net stop %servicename% >>UnInstallService.logcd %SystemRoot%\Microsoft.NET\Framework\v4.0.30319%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil /uninstall %filename% >>UnInstallService.logecho 卸载服务echo ======================================================================= >>UnInstallService.logecho *********************type UnInstallService.logecho.echo 操作结束,可以查看日志文件UnInstallService.log中具体的操作结果。:LastEndpauserem exit