-
Notifications
You must be signed in to change notification settings - Fork 242
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
daemon: start daemon from a powershell script that hides window #3775
Conversation
I think you tried this kind of approaches https://stackoverflow.com/questions/23250505/how-do-i-create-an-executable-from-golang-that-doesnt-open-a-console-window-whe to avoid showing the window? |
I proposed something similar as Christophe; make the executable be 'regarded' as a GUI application, but not actually create the window. Can this be tried? The issue with the script is that this can be marked again as a problem when it comes to 'false positives' on scans. |
I tried both the approaches mentioned there -- the issue with using the other method using the |
Did we test it works with win10 and win11 both? |
You can't "Each PE application contains a field in its header that specifies which subsystem it was designed to run under. You can say IMAGE_SUBSYSTEM_WINDOWS_GUI to mark yourself as a Windows GUI application, or you can say IMAGE_SUBSYSTEM_WINDOWS_CUI to say that you are a console application. If you are GUI application, then the program will run without a console." - Raymond Chen ... unless you do some trickery: "In VisualStudio case, there are actually two binaries: devenv.com and devenv.exe. Devenv.com is a Console app. Devenv.exe is a GUI app. When you type devenv, because of the Win32 probing rule, devenv.com is executed. If there is no input, devenv.com launches devenv.exe, and exits itself. If there are inputs, devenv.com handles them as normal Console app. In ildasm case, there is only one binary: ildasm.exe. It is first compiled as a GUI application. Later editbin.exe is used to mark it as console subsystem. In its main method it determines if it needs to be run as console mode or GUI mode. If need to run as GUI mode, it relaunches itself as a GUI app." - Junfeng Zhang ... so, let's conclude that it's not worth the extra effort at this point. |
yes, i have tested the script hides the powershell window on both win 10 and 11, but not an end-to-end test using |
after windows terminal became the default terminal/console host on windows the daemon scheduled task would show a console window upon running as its not recognizing the powershell cmdline argument for hiding the window this powershell script hides the window by using win32 api from powershell fixes crc-org#3726
tested on both windows 10 and windows 11 now and its working as expected, (still shows the powershell window briefly when running the new pushes were for fixing the quotes around the |
@anjannath: The following tests failed, say
Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gbraad The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
after windows terminal became the default terminal/console host on windows the daemon scheduled task would show a console window upon running as it wasn't respecting the poweshell cmdline argument for hiding the window
this powershell script hides the window by using win32 api from powershell
fixes #3726