Update documentation about --no-console and conhost for Windows

I’m using 2 instances scenario. And I faced with even if I run 1st instance with “syncthing --no-browser --no-console” and it usually closes the window (even I saw it may not close sometimes), second instance command “syncthing --no-browser --no-console --home=%LOCALAPPDATA%\” does not close the console window

I found one of solutions: the usage of “conhost” ( -no-console option does not work when Windows Terminal is set as Default Terminal application · Issue #8046 · syncthing/syncthing · GitHub ) and it works just fine

I think it would be nice to mention “conhost” in Starting Syncthing Automatically — Syncthing documentation page and maybe in Command Line Operation page > –no-console flag

The problem is that most users probably don’t want to disable Windows Terminal and go back to the old console as their default shell. I think we should probably recommend the Task Scheduler way as the main method to run Syncthing hidden, because that one can always hide the console window even without using --no-console with Syncthing.

In other words, the Startup folder solution isn’t really viable anymore, at least not as a general recommendation.

1 Like

Ok, I just set up approach with Task Scheduler:

  • Windows 11
  • Settings > System > For Developers > Terminal = Windows Terminal
  • Task Scheduler >
    • created 2 tasks for “start on logon”
    • syncthing --no-browser --no-console
    • and syncthing --no-browser --no-console --home=%LOCALAPPDATA%\Something
  • restarted the system

as-is: 2 console windows

What I was talking about:

to mention that if you are using “–no-console” you may face with situation of not hiding console windows

in that case usage of conhost helps: “conhost syncthing --no-browser --no-console”

What I meant is that if you follow the method from https://docs.syncthing.net/users/autostart.html#autostart-windows-taskschd and set the task to run whether the user is logged on or not, Syncthing will always start in background even without --no-console.

I see what you mean about using conhost though, I will try to do some testing and possibly update the Docs to use it for the other autostart methods :slight_smile:.

I just added a second shortcut to Startup with different --home and rebooted: no Terminal window. I set Start window: Minimised for the shortcut.

Workaround by @cosas

For me run: minimized had (still has, as long as I’m not a usual Windows user) the merit of completely hiding the console. --no-console does its own job OK (--no-console all alone, the console won’t even show as a stable terminal application button in the task bar) and run: minimized just prevents the stealth window/button on startup… all fine… for me with single instance… in friends computers.

Happy new year the Devs ans users

1 Like

Windows Terminal does not completely replace the default PowerShell (even within Windows Terminal, Start-Process may invoke the legacy PowerShell). Using Start-Process in PowerShell correctly hides the command line window. Therefore, when creating a shortcut, you can first call PowerShell and then use PowerShell to create the Syncthing process. The shortcut should point to:

powershell.exe -Command "Start-Process -FilePath 'C:\Program Files\Syncthing\syncthing.exe' -ArgumentList '--no-console --no-browser'"

(Replace C:\Program Files\Syncthing\syncthing.exe with the actual path to your Syncthing executable. ) This approach ensures no window appears when starting the shortcut, whether manually or via the startup folder.

1 Like