返回

配置Syncthing为Windows后台服务的简易指南

本文介绍如何将Syncthing注册为Windows后台服务,以实现自启功能
2020-04-10
919 字 · 约 3 分钟阅读

Windows的后台服务常驻机制通常是流氓软件后台常驻,而正经软件想后台常驻都需要一些技巧

Syncthing是一款同步文件工具,支持多平台,开源且免费

想在 Windows 上实现后台常驻:

  • 计划任务
  • 注册成服务

不同版本的Windows计划任务可靠性不一致,不算是个非常保险的方法

借助 nssm 工具可以将软件注册成 Windows 系统服务,nssm 是一个开源的 Windows 服务管理工具,可以将任何可执行文件注册为 Windows 服务

nssm 的官网在 https://nssm.cc/,在下载syncthing与nssm之后,可以使用如下指令注册成后台服务:

.\nssm.exe install syncthing "C:\Programs\syncthing-windows-amd64-v1.13.1\syncthing.exe" '-home="C:\Programs\syncthing-windows-amd64-v1.13.1\config"'
.\nssm.exe start syncthing

在 PowerShell 中执行上述命令过程,注意路径需要根据实际情况调整

PS C:\Programs\nssm-2.24\win64> .\nssm.exe install syncthing "C:\Programs\syncthing-windows-amd64-v1.13.1\syncthing.exe" '-home="C:\Programs\syncthing-windows-amd64-v1.13.1\config"'
Service "syncthing" installed successfully!
PS C:\Programs\nssm-2.24\win64> .\nssm.exe start syncthing
syncthing: START: The operation completed successfully.

syncthing: START: The operation completed successfully. 提示就说明后台服务注册成功了

留言

发表留言