ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

Windows 服务安装与卸载 (通过 Sc.exe)

2019-12-23 10:57:16  阅读:336  来源: 互联网

标签:bat exe Service Platform Windows Device Sc Verity


1. 安装

 

  • 新建文本文件,重命名为 ServiceInstall.bat,将 ServiceInstall.bat 的内容替换为:

sc create "Verity Platform Device Service" binPath= "%~dp0WindowsService_HardwareDevice.exe"

sc description "Verity Platform Device Service" "提供设备连接、FMC 电压、PLL 时钟、FPGA 配置、寄存器访问等相关服务"

sc config "Verity Platform Device Service" start= AUTO

sc start "Verity Platform Device Service"

pause

 

注1:"Verity Platform Device Service" 为服务名;

注2:WindowsService_HardwareDevice.exe 为自己创建的用于承载 WCF 服务的的 Windows服务的安装程序,创建方式如下:

     https://docs.microsoft.com/zh-cn/dotnet/framework/wcf/feature-details/how-to-host-a-wcf-service-in-a-managed-windows-service

  注3:pause 的作用为 .bat  运行完不退出,以查看运行结果(也可使用 @cmd.exe)。

 

  • 管理员身份运行 ServiceInstall.bat 完成 Windows 服务安装。

 

2. 卸载

 

  • 新建文本文件,重命名为 ServiceUninstall.bat,将 ServiceUninstall.bat 的内容替换为:

sc stop "Verity Platform Device Service"

sc delete "Verity Platform Device Service" binPath= "%~dp0WindowsService_HardwareDevice.exe"

@cmd.exe

 

管理员身份运行 ServiceUninstall.bat 完成 Windows 服务安装。

 

 

 

标签:bat,exe,Service,Platform,Windows,Device,Sc,Verity
来源: https://www.cnblogs.com/dhqy/p/12082555.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有