I don’t use Syncthing like that, but the concept is interesting. This looks like what @Catfriend1 has been doing in his Syncthing Fork for Android.
I assume that curl
is a 3rd party utility here, right? You could use PowerShell
(see https://forum.syncthing.net/t/how-to-call-the-rest-api-from-windows-powershell/11269) to query the REST API instead to make the script more universal and not rely on any external tools.
How are you going to kill the process? I only want to warn that it is impossible with taskkill
without the /f
switch, which I would not recommend, as it is a very brute-force solution and may lead to issues.
Killing the Task Scheduler task itself also doesn’t work, because it only kills the parent process, while the child process persists (see https://github.com/syncthing/syncthing/issues/7042).