目录
WinSW
* WinSW(Windows Service Wrapper)是一个开源项目,它可以让我们快速把一个可执行的程序注册为Windows的系统服务。
* 可以使得程序可以自启动,或者是可以关闭cmd窗口后保持运行。
环境
- Windows系统:Win11
- 系统自带的服务控制:services.msc
- -
- -
- 如果找不到的话可以通过运行窗口调用起来
- 首先按 win + r 调出运行窗口
- 然后输入 services.msc ,回车
- -
- WinSW
- 版本:v3.0.0
- github地址:https://github.com/winsw/winsw
使用方法
- 下载WinSW
- 复制 WinSW-x64.exe 到想要注册为服务的程序所在目录。
- 这里以注册nginx为例:
- 记住你下载的WinSW的名字,比如我的是WinSW.exe,那就新建一个同名的WinSW.xml.
- 当然你可以修改程序的名字,比如改为hello.exe,那就要新建一个同名的hello.xml.
- 直接在当前目录下右键新建文本文件
- -
- 写入如下内容
- 分析(仅说明需要修改的地方):
- 具体见相关外链:winsw配置文件参数解释说明 - 安夜的cookie
- <id>:指定Windows内部用户标识服务的id;在系统安装的所有服务中id必须是唯一的,并且完全由字母数字字符组成。
- <name>:服务的简短显示名称,可以包含空格和其他字符;在系统的所有服务中name也必须是唯一的。
- <description>:对服务的完整描述。
- <executable>:指定要启动的可执行文件,可以是绝对路径,也可以只指定可执行文件名称并从PATH中搜索。
- <startargument>启动时的传递参数
- <stopargument>停止时的传递参数
- 一般修改<id> <name> <description> 都写为服务名就可以了。
- <executable>写exe程序所在的路径,且路径尾部包含程序名
- <logpath>写exe程序所在路径即可
- <startargument>一般改成程序的路径,后面添加对应的程序启动的命令
- 比如frps一般的启动命令是frps -s frps.ini
- 这样的话这里就可以在路径后面增加 -s D:\frp\frps.ini
- 注意所有文件路径最好都用绝对路径
- <stopargument>一般改成程序路径,并且后面的-s stop改为对应的程序停止的命令
- 同<startargument>的写法。
<?xml version="1.0" encoding="UTF-8" ?>
<service>
<id>nginx</id>
<name>nginx</name>
<description>nginx</description>
<executable>D:\0Acoolight\App\nginx\nginx-1.20.2\nginx.exe</executable>
<logpath>D:\0Acoolight\App\nginx\nginx-1.20.2\</logpath>
<logmode>roll</logmode>
<depend></depend>
<startargument>-p D:\0Acoolight\App\nginx\nginx-1.20.2</startargument>
<stopargument>-p D:\0Acoolight\App\nginx\nginx-1.20.2 -s stop</stopargument>
</service>
- -
- 把文本文件另存为xml文件,如果不另存为的话,其后缀仍是txt
- 在当前目录下启动cmd。
- 安装服务,在cmd中输入以下命令并回车执行:
- WinSW-x64.exe install
- 至此,系统的服务管理中已经会有nginx这个服务了
- 调出服务管理的方法参见本文开头
调整服务为自启动
- 选中nginx服务项
- 右键,然后点击属性
- 如图,启动类型选择自动,并保存即可。
手动启动服务
- 如果服务没有启动,可以手动启动一下它
- 在服务管理中选中nginx,然后右键,点击 “启动” 即可。
https://doxycyclinea.online/# doxycycline prices
https://amoxila.pro/# amoxicillin 500mg capsules price
doxycycline 100mg dogs: order doxycycline online – vibramycin 100 mg
200 mg doxycycline: buy doxycycline online without prescription – buy doxycycline hyclate 100mg without a rx
brand neurontin 100 mg canada neurontin cost gabapentin 300mg
buy doxycycline without prescription uk doxycycline hyclate where to get doxycycline
prednisone 40 mg daily: prednisone 5084 – buying prednisone on line
http://amoxila.pro/# amoxicillin buy no prescription
prednisone 20 where can i buy prednisone without a prescription order prednisone 10mg
https://prednisoned.online/# prednisone 10 mg online
https://doxycyclinea.online/# how to buy doxycycline online
odering doxycycline: doxycycline 100mg tablets – online doxycycline
neurontin over the counter neurontin from canada neurontin 800 mg tablets
prednisone 21 pack buy 40 mg prednisone 5 mg prednisone tablets
buy zithromax: generic zithromax 500mg – zithromax for sale us
doxycycline 50mg: order doxycycline 100mg without prescription – doxycycline generic
buy zithromax: zithromax 250mg – zithromax 500mg
prednisone price: where to buy prednisone 20mg no prescription – prednisone 20 mg pill
neurontin 800 mg tablet: buy generic neurontin – neurontin pfizer
https://zithromaxa.store/# zithromax buy online
https://gabapentinneurontin.pro/# neurontin brand name 800 mg
where can i get zithromax: zithromax antibiotic – buy zithromax online
https://amoxila.pro/# can you purchase amoxicillin online
zithromax online paypal: zithromax for sale cheap – zithromax without prescription
10 mg prednisone canadian online pharmacy prednisone 10mg prednisone daily
doxycycline tetracycline buy doxycycline online uk buy doxycycline online uk
prednisone 300mg: prednisone 10mg tabs – buy prednisone nz
zithromax azithromycin: buy zithromax online australia – how much is zithromax 250 mg
amoxicillin 1000 mg capsule: purchase amoxicillin online without prescription – amoxicillin 500 mg tablet price
http://zithromaxa.store/# can you buy zithromax online
zithromax cost canada: zithromax over the counter – buy zithromax online cheap
zithromax capsules australia zithromax 500mg can i buy zithromax over the counter
https://gabapentinneurontin.pro/# neurontin 600 mg capsule
prednisone cream brand name: buy prednisone with paypal canada – price of prednisone 5mg
https://prednisoned.online/# prednisone price
cost of amoxicillin amoxicillin no prescription where to buy amoxicillin 500mg
amoxicillin 500 capsule: order amoxicillin no prescription – price of amoxicillin without insurance
дайсон фен цена http://www.dyson-feny.com .
prednisone 50 mg for sale 1 mg prednisone daily 100 mg prednisone daily
prednisone 15 mg daily: prednisone 20mg by mail order – prednisone 20 mg without prescription
http://doxycyclinea.online/# generic doxycycline
doxy doxycycline without a prescription doxycycline hyclate
how to buy amoxicillin online: where can i buy amoxocillin – amoxicillin over the counter in canada
https://prednisoned.online/# prednisone 10mg
https://amoxila.pro/# amoxicillin 500mg capsules price
5 mg prednisone tablets: 20 mg prednisone – buy prednisone online australia
generic amoxicillin over the counter: where to buy amoxicillin – amoxicillin buy online canada
prednisone 15 mg daily: prednisone 2.5 tablet – buying prednisone without prescription
how to order doxycycline doxycycline buy cheap doxycycline online
doxycycline without prescription 100mg doxycycline doxycycline hydrochloride 100mg