-
Notifications
You must be signed in to change notification settings - Fork 571
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
Conversation
additional information on running with command line interface and hiding the console pop-up
I would suggest to change the order, i.e. put the existing graphical instructions first, and the command line instructions later. We link to this guide quite often from the forum, so I think it would be better not to overwhelm less tech-savvy users with command line on the first sight. I'm also not sure if mentioning VBScript is really worth it, as it is on its way out and is going to be removed from Windows in the next few years (see https://techcommunity.microsoft.com/blog/windows-itpro-blog/vbscript-deprecation-timelines-and-next-steps/4148301). |
improve docs by putting hard instructions on the end section also hide VBScript due to future deprecation
accidentally removed a dot
@tomasz1986 |
@rasa Hello, something is missing to the merge? |
users/autostart.rst
Outdated
|
||
``script.ps1``:: | ||
|
||
Start-Process "<path to syncthing>.exe" -WindowStyle Hidden |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your schtasks example includes --no-console --no-browser
but your
Powershell example doesn't. Perhaps it should, so the two examples mirror each other?
Also, isn't -File
required? So: powershell -File <path to script>.ps1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Windows Terminal and Default Console:
In modern Windows versions, particularly with Windows Terminal set as the default console application, the --no-console flag might not completely hide the console window. It might still appear and then minimize, or the flag might be ignored entirely.
https://forum.syncthing.net/t/win-10-and-11-updates-breaks-no-console/19142
I was trying the --no-console
flag that only exists in the Windows
version of the syncthing
and faced some issues related.
Switching to the mentioned legacy mode
may be discouraged, since Windows Terminal
is being a default on all new installations.
Wrapping with a ps1
script works even on wt.exe
pop-ups.
-File/-FilePath
is not mandatory.
Start-Process
[-FilePath] <string>
[[-ArgumentList] <string[]>]
[-WorkingDirectory <string>]
[-PassThru]
[-Verb <string>]
[-WindowStyle <ProcessWindowStyle>]
[-Wait]
[-Environment <hashtable>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
https://learn.microsoft.com/pt-br/powershell/module/microsoft.powershell.management/start-process?view=powershell-7.5
https://learn.microsoft.com/pt-br/powershell/module/microsoft.powershell.management/start-process?view=powershell-5.1
If you give the path as a first argument, it assumes that is the -FilePath flag as you can see above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might also try conhost.exe --headless ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might also try
conhost.exe --headless ...
I've not tested it. Feel free to contribute and do it. I don't have Windows installation on my PC right now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-File/-FilePath
is not mandatory.
I wasn't referring to Start-Process
but to the powershell command itself:
powershell -File "<path to script>.ps1"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still works without -File
, but I'm not sure if it implicitly defaults to -File script.ps1
or rather -Command script.ps1
🙃.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It still works without
-File
, but I'm not sure if it implicitly defaults to-File script.ps1
or rather-Command script.ps1
🙃.
Unfortunately @rasa example is what happening in my system too.

So, the -File
flag is mandatory in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-File/-FilePath
is not mandatory.I wasn't referring to
Start-Process
but to the powershell command itself:
powershell -File "<path to script>.ps1"

I can only find docs offline about powershell.exe
. But, as you can see, even if it is treated as optional, you'll need to use the dot operator
to resolve file paths. Using -File
directly can be more user friendly considering that the operator is less known by non programmers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made some changes according to the suggestions. Please check #936. conhost.exe
example may be unnecessary and duplication of that subject. @tomasz1986 will powershell example be sufficient? Both seems to be working, but i can't even find online docs for the additional command and both seems to work.
https://learn.microsoft.com/en-us/windows/console/definitions#console-host
User may be overhelmed similar to vbsript
usage. Following a standardized approach with powershell may be the case and only mention other technologies when it not work IMHO. 🤗
Just my opinion, but after looking at the PR, and also the other PR from #936, my feeling is that we may be getting a bit too in depth here. This goal of this section is to provide the user with a few methods that would let them start Syncthing automatically on startup/boot, not to teach them how to use the command line 😉. At the moment, the existing instructions can be summarised as follows:
I'm not sure adding yet another entry just to explain how to use PowerShell with Task Scheduler is really the way to go. How about adding |
@tomasz1986 thank you for the review. I'll be making changes to fit your suggestions. Since it's a complete rework of the docs instead of just another section, it may consume more time. @Shablone can help me merge the changes. Click in the ASAP i'm making new commits with new screenshots as like as the current ones. |
@rafaeloledo My second point about the Task Scheduler was wrong. As in the instructions we always recommend to "Run whether user is logged on or not", Syncthing runs hidden in background with no need for any additional tweaks. In the meantime, I have pushed a minimal PR to remove |
Waiting for the merge of #955 to make more changes here and not break anything. |
![]() I've managed to make the service work as this:
Start-Process -FilePath "C:\dev\scoop\apps\syncthing\current\syncthing.exe" -ArgumentList "--no-browser" -WindowStyle Hidden
schtasks /create /sc ONLOGON /tn Syncthing /tr "powershell -File C:\\dotfiles\\win32\\syncthingw.ps1" The thing is @tomasz1986 and @rasa: running with |
Yeah, so the question remains, is there any benefit of recommending PowerShell instead of I think the |
No sign of Since it's desired to not have |
You've removed a bit much 😉. I've actually got an idea how to add the information with your actual PowerShell command, but #955 needs to be merged first for it to work. |
From my experience, using PowerShell has the potential to create more headaches. I've run into restrictive execution policies, which can be really tricky. I think the conhost solution is reasonable and pragmatic since it works without additional hurdles for now. In the long run, instead of having another workaround, it might be ideal if Syncthing itself had a proper native background mode with tray functionality or. so That would make these console workarounds unnecessary. |
@Shablone ![]() The current PR is aiming just for docs improving. I mean, we need to tell the user that, currently, the So, when someone made BTW, i've good experience with
As an example, i've made a In the first versions i was using the old https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmic ![]() |
I'm sorry for changing the subject: The console flashes because Syncthing is built as a console application. We can create a separate build (e.g., I've tested this and it works. The change is minimal: conditionally add the This would be a separate build to avoid breaking console functionality for the main binary. It's a clean, native solution for users who only run Syncthing as a service. For windows we actually could ship both console and no-console by providing two files e.g.: syncthing.exe and syncthing-d.exe |
Following @Shablone point, the service can only run with 2025-09-01.14-37-13.mp4Then, the user must run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Or other permissive policy similar to |
Good idea Closing for the following reasons that have been discussed in this PR:
|
One additional detail here. schtasks /create /sc ONLOGON /tn Syncthing /tr "powershell -ExecutionPolicy RemoteSigned -File C:\\dotfiles\\win32\\syncthingw.ps1" You can specify the |
Creating tasks without the GUI--no-console
(see fix(autostart): remove --no-console from Windows instructions (fixes #945) #955 )Workarounds on running without console pop-up (relates to Update autostart.rst #861 )