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 服务卸载。

 

 

 

相关文章:

  • 2022-12-23
  • 2021-11-28
  • 2021-12-15
  • 2021-12-18
  • 2021-04-02
  • 2022-01-14
  • 2021-12-10
猜你喜欢
  • 2022-02-25
  • 2021-06-08
  • 2022-12-23
  • 2022-12-23
  • 2021-09-04
  • 2021-09-23
  • 2021-07-23
相关资源
相似解决方案