C# WindowService 安装和卸载

安装脚本

install.bat 内容

@echo 安装WindowService
%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\installutil.exe WindowsService.exe
net Start Service1

@echo 成功!
pause

卸载脚本

uninst.bat

@echo 安装WindowService
%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\installutil.exe /u WindowsService.exe

@echo 成功!
pause

注意事项:

.net 版本 根据应用程序选择 上面用的是 .net 3.5版本开发,所以用的是v2.0.50727,路径在C:\Windows\Microsoft.NET\Framework

Service1 是服务名称

如果你对编程感兴趣或者想往编程方向发展,可以关注微信公众号【筑梦编程】,大家一起交流讨论!小编也会每天定时更新既有趣又有用的编程知识!
 

猜你喜欢

转载自blog.csdn.net/weixin_44811417/article/details/91352690