Skip to content

Conversation

@tomasz1986
Copy link
Member

@tomasz1986 tomasz1986 commented Aug 31, 2025

fix(autostart): remove --no-console from Windows instructions

With the advent of Windows Terminal and it being the default shell both
in newer releases of Windows 10, and in Windows 11, the --no-console
command line switch no longer works. For this reason, remove it from the
commands listed in the autostart instructions. When it comes to the Task
Scheduler part, it has never actually been needed anyway, and in the
Startup folder instructions, it can be worked around by using the native
conhost.exe --headless method.

Signed-off-by: Tomasz Wilczyński twilczynski@naver.com
Co-authored-by: Rafael Ledo rafaeloliveiraledo@gmail.com

@tomasz1986
Copy link
Member Author

tomasz1986 commented Aug 31, 2025

Please note that the screenshots will also need to be updated, but I'm leaving that for later (as I would like to spin up a Windows 11 VM in order to take them in a clean environment, but I won't be able to do it in a short time).

Screenshots have been added.

@rafaeloledo
Copy link

I'm with a Win11 installation up and running. I can continue the screenshots and Task Scheduler-related changes in #926.

@tomasz1986 tomasz1986 changed the title fix(autostart): remove --no-console from Windows instructions fix(autostart): remove --no-console from Windows instructions (fixes #945) Aug 31, 2025
@rafaeloledo
Copy link

rafaeloledo commented Sep 3, 2025

@tomasz1986 i've made some image adjustments on rafaeloledo@97e8b97

i think you have access to it, since it's a fork

Summary

  • users/windows-nssm-config.png fixed the single - to be -- and removed --no-console
  • users/windows-startup-addressbar.png slightly larger
  • users/windows-startup-createshortcut.png removed --no-console
  • users/windows-startup-newshortcut.png updated image
  • users/windows-taskschd-actions.png removed --no-console
  • users/windows-taskschd-additional-actions.png updated image
  • users/windows-taskschd-additional-conditions.png untranslated particle Rede to Network (PT)
  • users/windows-taskschd-createtask.png updated image
  • users/windows-taskschd-general.png different author
  • users/windows-taskschd-settingstab.png updated image
  • users/windows-taskschd-triggers-logon.png different author
  • users/windows-taskschd-triggers-startup.png updated image

@tomasz1986
Copy link
Member Author

Thanks for the screenshots, I think in this specific PR including the ones that have --no-console removed is appropriate. How would you prefer to be recognised as the author of them? If I download and push them to the PR myself, the whole PR will still end up being authored by myself only.

@calmh
Copy link
Member

calmh commented Sep 3, 2025

You can just add a co-authored-by when merging.

@rafaeloledo
Copy link

You can just add a co-authored-by when merging.

This is sufficient.

@tomasz1986 tomasz1986 marked this pull request as draft September 4, 2025 22:45
@tomasz1986 tomasz1986 force-pushed the tomasz86/prs/update-windows-autostart branch from 11da5ae to 1d1c4f4 Compare September 7, 2025 15:37
With the advent of Windows Terminal and it being the default shell both
in newer releases of Windows 10, and in Windows 11, the `--no-console`
command line switch no longer works. For this reason, remove it from the
commands listed in the autostart instructions. When it comes to the Task
Scheduler part, it has never actually been needed anyway, and in the
Startup folder instructions, it can be worked around by using the native
`conhost.exe --headless` method.

Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
Co-authored-by: Rafael Ledo <rafaeloliveiraledo@gmail.com>
Signed-off-by: Tomasz Wilczyński <twilczynski@naver.com>
@tomasz1986 tomasz1986 force-pushed the tomasz86/prs/update-windows-autostart branch from 1d1c4f4 to 414244e Compare September 7, 2025 15:39
@tomasz1986 tomasz1986 marked this pull request as ready for review September 7, 2025 15:41
@rafaeloledo
Copy link

The images that not get merged are out of scope of this PR, right? Sorry for that. 🤗

@239
Copy link

239 commented Jan 9, 2026

With the advent of Windows Terminal and it being the default shell both
in newer releases of Windows 10, and in Windows 11, the --no-console
command line switch no longer works.

It still works with Run: Minimized

Minimized

@rafaeloledo
Copy link

rafaeloledo commented Jan 10, 2026

I've tested here with .lnk and it's working. It's even possible to run them with .cmd/.bat.

The behavior is: when using Normal Window, it runs with Windows Terminal, when using Minimized, it runs with conhost.

@tomasz1986 so, we may instruct the user to run wrapped on a .lnk?

Edit 1: Tested Start-Process -WindowStyle Minimized and the behavior is not the same of .lnk Minimized, it keeps calling Windows Terminal no matter the -WindowStyle
Edit 2: Only double-clicking on the .lnk will make it not pop the Windows Terminal. I've tested wrapping the lnk on a .bat file with @echo off, it still opens a flash of wt.exe.

So, indeed the .lnk solution is working. But it has limitations and not solve the problem entirely. The thing is that Windows Terminal is being set as the new default for console applications. The --no-console solution was built in a context that is not the Windows 11 way. It's natural to be considered deprecated.

Even if we advertise the user to use .lnk, it only not pops the terminal if he manually clicks on the icon, which i think is not desired.

@rafaeloledo
Copy link

rafaeloledo commented Jan 10, 2026

@tomasz1986 I've been studying Windows a bit those last days. Since Windows NT, Microsoft launched the sc.exe API to create services, which is different from tasks. It's a bit confusing here.

What i can explain here is, creating a service, a real service and not a task, it can execute syncthing.exe without calling Windows Terminal.

But, it doesn't require the user to click every time.

I've analyzed the sc.exe call stack and it uses conhost with already a "hidden" behavior to trigger execution.

So, in my early PRs i've suggested the schtasks. But for this demand of not showing the console, it can be accomplished only with this API.

image

The only problem i found is when i run the service manually, it can not be controlled by the internal Manager. But it does not block the execution despite of not being able to communicate with the syncthing thread.

:: create service
sc.exe create syncthing binPath="<path-to-syncthing.exe> --no-browser" start=auto DisplayName="syncthing"
:: delete service
sc.exe delete syncthing
:: start service
sc.exe start syncthing

Then, following Ockham's Razor, my suggestion is removing --no-console flag from docs at least since it's not well supported now. Finally, we can tell the user to create services as above. The problem is that syncthing is not implementing communication with Windows Services Control API, so it can't be stopped by the manager, requiring the user to kill the program with Task Manager.

taskkill /IM "syncthing.exe" /F

@rafaeloledo
Copy link

rafaeloledo commented Jan 10, 2026

Currently working on implementing Windows Service API. Finishing in the next days.

https://github.com/rafaeloledo/syncthing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants