diff --git a/assets/windows/syncthing.exe.manifest b/assets/windows/syncthing.exe.manifest new file mode 100644 index 000000000..3757f2abc --- /dev/null +++ b/assets/windows/syncthing.exe.manifest @@ -0,0 +1,8 @@ + + + + + detached + + + \ No newline at end of file diff --git a/build.go b/build.go index 35c568d98..779b6a27e 100644 --- a/build.go +++ b/build.go @@ -732,9 +732,18 @@ func shouldBuildSyso(dir string) (string, error) { sysoPath := filepath.Join(dir, "cmd", "syncthing", "resource.syso") // See https://github.com/josephspurrier/goversioninfo#command-line-flags - arm := strings.HasPrefix(goarch, "arm") - a64 := strings.Contains(goarch, "64") - if _, err := runError("goversioninfo", "-o", sysoPath, fmt.Sprintf("-arm=%v", arm), fmt.Sprintf("-64=%v", a64)); err != nil { + // For manifest see https://learn.microsoft.com/en-us/windows/console/console-allocation-policy + isARM := strings.HasPrefix(goarch, "arm") + is64Bit := strings.Contains(goarch, "64") + + args := []string{ + "-manifest=assets/windows/syncthing.exe.manifest", // console-allocation-policy + "-o", sysoPath, // output path + fmt.Sprintf("-arm=%v", isARM), + fmt.Sprintf("-64=%v", is64Bit), + } + + if _, err := runError("goversioninfo", args...); err != nil { return "", errors.New("failed to create " + sysoPath + ": " + err.Error()) } diff --git a/cmd/syncthing/hideconsole_windows.go b/cmd/syncthing/hideconsole_windows.go index f51e8acc3..ef0848914 100644 --- a/cmd/syncthing/hideconsole_windows.go +++ b/cmd/syncthing/hideconsole_windows.go @@ -7,5 +7,5 @@ package main type buildSpecificOptions struct { - HideConsole bool `name:"no-console" help:"Hide console window" env:"STHIDECONSOLE"` + HideConsole bool `name:"no-console" help:"Hide console window (Always enabled on Windows 11 24H2 and later)" env:"STHIDECONSOLE"` }