I will describe the way to start syncthing in the background via the Windows Task Scheduler System SCHTASKS. Syncthing will then start with the System and run with the given User-Rights.
Creating the task:
Run this CMD line in the syncthing directory or replace %CD% with right path. To run syncthing without login you have to set your USERNAME and PASSWORD.
When I create the task it says it was successfully created and when I try to run it, it also says it worked, but then when I go to 127.0.0.1:8080 nothing shows up, and I can’t find the task using the task manager either.
I had this problem as well, it turned out for me it was because my path had a space in it because I put the executable in Program Files so it thought the executable was called C:\Program and the options were Files etc. I fixed it by using the GUI:
Open the task scheduler GUI, (I did this by right clicking on computer in the start menu and selecting manage but you can also do it by searching for task scheduler and opening it)
Go to the Task Scheduler Library (its like a tree view, you will find it if you look)
Right click and select properties on the syncthing task you created
Select the actions tab and select and click edit on the “Start a program” line
Fix it, click OK, OK, OK etc…
Hopefully this helps
PS: No wonder vsandre explained how to set it up on the command line, theres a lot of clicking about!
Thanks for sharing this. I followed your instructions, not having much experience with Win tasks. It seemed to crash syncthing though, so I went back to starting it manually. However, looking at the Task Scheduler today, I noticed, that your command will stop syncthing when the computer is on battery! That’s nice, but it might explain why I couldn’t get it to run reliably. This should be mentioned in your howto.
Also, since there doesn’t seem to be a way to paste text in the cmd window, it’d probably improve this howto if you mentioned, that this had to be done with administrator rights. I forgot about that, and had to type in your lengthy command (that I obviously did not understand completely) twice
I had some problems with this and found what I think is a bug in Windows (7/Pro/64). Even if you put your path and filename in quotes ("), the task scheduler will treat the part up to the first space (C:\Program) as the executable to be run, and the rest (Files…) as parameters. I found that it is possible to get round this by enclosing the full path/filename in double quotes and then additionally in single quotes.
You guys might check out nssm, it is a way to run any program on a service on windows, and it will restart it if it dies, etc. I have syncthing running on my wife’s computer with this. I’ll post how I got it to work later if someone else doesn’t beat me to it.
I you want to run Syncthing on startup and hide the command line window completely (also no tray icon) you can edit the task in the task scheduler GUI (as @NeonHorizon described above) and check “hidden” in the properties. Please note that this only starts Syncthing at bootup but it is not run as a service (e.g. if you kill the task it will not restart). As an alternative you can use SyncTray (https://github.com/iss0/SyncthingTray) which creates a tray icon with a simple user interface for start/stop