Need help - --no-console either doesn't work or I'm misunderstanding it

From the docs for --no-console: “Hide the console window. (On Windows only)”. I have a shortcut in my startup folder that runs Syncthing with --no-console --no-browser, but a console window still pops up when it runs. How can I silently run Syncthing in the background? I can’t use the Task Scheduler either as Microsoft broke tasks that use the “Run whether user is logged on or not” setting a few months back and still hasn’t fixed it.

Without more detailed information (e.g. screenshots), I’d guess that it’s probably the same problem in both cases. You need to change the default “terminal app” from Windows Terminal back to Windows Console Host (see https://devblogs.microsoft.com/commandline/windows-terminal-as-your-default-command-line-experience).

And that you have to do this is of course not ideal. There’s recently been a discussion about this topic you might want to checkout for the techical background: https://forum.syncthing.net/t/windows-console-window

There’s also a pending PR to tackle the problem but it isn’t that easy: cmd/syncthing: Compile as GUI application, attach or allocate console instead (ref #8046, ref #8248) by AudriusButkevicius · Pull Request #8763 · syncthing/syncthing · GitHub

Well that’s disappointing to hear. I want Windows Terminal as my default terminal so that doesn’t work for me. Sounds like there’s no (or at least no easy) solution until either Syncthing figures something out or Microsoft fixes the Task Scheduler.

What happens if in Task Scheduler you put powershell.exe in the Program/script field, and Start-Process -FilePath "syncthing.exe" -WindowStyle Hidden in the Add Arguments field? Of course, use the full path to your actual syncthing.exe executable in the command.

1 Like

That seems to work! The only change I had to make is passing the script to Powershell via -c. So, pwsh.exe -c "Start-Process -FilePath 'syncthing' -ArgumentList '--no-browser' -WindowStyle Hidden". Works via a shortcut as well.

Thanks for the suggestion, didn’t realize you could start processes in hidden windows like that.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.