Skip to content

docs: add more context to Windows execution #926

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 20 additions & 19 deletions users/autostart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,27 +34,8 @@ start Syncthing automatically either at user log on, or at system
startup. In both cases, Syncthing will open and stay invisible in
background.

It's possible to run Windows Task Scheduler CLI API with a command such as
``schtasks /create /sc ONLOGON /tn Syncthing /tr "<program-path> [--no-console --no-browser]"``.
The operation requires elevated privileges. Preventing the pop-up console that hides after
some delay is possible wrapping the executable with a ``.vbs or .ps1``.

vbs::

Dim objShell
Set objShell = CreateObject("WScript.Shell")
objShell.Run "path to syncthing.exe", 0, False
Set objShell = Nothing

ps1::

Start-Process "path to syncthing.exe" -WindowStyle Hidden

For technical information about Task Scheduler visit
https://docs.microsoft.com/windows/win32/taskschd
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks

Or follow the Graphical tutorial below:

#. Start the Task Scheduler either by going to ``Start Menu > Windows
Administrative Tools`` and clicking on ``Task Scheduler``, or by
Expand Down Expand Up @@ -271,6 +252,26 @@ by a sysadmin who knows enough to understand the security implications.
#. Start the service via ``sc start syncthing`` in the Command Prompt.
#. Connect to the Syncthing UI, enable HTTPS, and set a secure username and password.

For Hard Users
^^^^^^^^^^^^^^

It's possible to run Windows Task Scheduler CLI API with a command such as
``schtasks /create /sc ONLOGON /tn Syncthing /tr "<program-path> [--no-console --no-browser]"``.
The operation requires elevated privileges. Preventing the pop-up console that hides after
some delay is possible wrapping the executable with a ``PowerShell`` script.

``script.ps1``::

Start-Process "<path to syncthing>.exe" -WindowStyle Hidden

Then run as admin::

schtasks /create /sc ONLOGON /tn Syncthing /tr "powershell <path to script>.ps1"


For more information, please read official docs for Command Line Interface API:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/schtasks

macOS
-----

Expand Down