Nacos为例
1.将WinSW的配置文件sample-minimal.xml和运行文件WinSW.NET461.exe放在Nacos/bin目录下
并将其改名为nacos-service.xml和nacos-service.exe
2.修改xml配置文件
<service>
<!-- ID of the service. It should be unique across the Windows system-->
<id>Nacos</id>
<!-- Display name of the service -->
<name>Nacos</name>
<!-- Service description -->
<description>NacosService</description>
<!-- Path to the executable, which should be started -->
<executable>D:\nacos\bin\startup.cmd</executable>
<arguments>-m standalone</arguments>
<logpath>E:\WinSW\nacos</logpath>
</service>
3.管理员模式下运行cmd注册服务
./nacos-service.exe install
4.启动服务,服务名称为xml中配置的名称
net start Nacos
5.启动成功后看服务列表