-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
PowerShell argument WindowStyle -Hidden
is not respected when the default terminal application is Windows Terminal
#12464
Comments
PowerShell/PowerShell#3028 looks like it's related. This probably requires quite a bit of thinking... |
Dustin wrote a spec for this a while back that doesn't seem to have ever been merged: #7337 Looking at it now the odd part is asking console processes to call ShowWindow. That doesn't seem to fit well with what Terminal is trying to do w.r.t. multi-tab, multi-pane, etc. |
The console window being shown for a second may still be tolerable but with WT the window isn't hidden at all - there's no difference between using the PowerShell argument |
just to note, Terminal also doesn't allow the old vbs script trick. |
It looks like the windowing work done in 1.14 fixed the PowerShell case, but we still have #12154 to consider. |
Did this break again somewhere along the way? |
Yeah I've just updated to 1.15.2875.0 and still getting this issue |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
I'm gonna lock this thread for a bit to give everyone some time to relax. Obviously, this is still busted (at least, for Powershell 7 |
NO it does not... with the "default" console both of this work: |
Yeh confirmed it just minimises it. I have found what seems to be a work around though: $script:showwindowAsync = Add-Type -memberDefinition @" $showwindowAsync: : ShowWindowAsync( (Get-Process -id $pid).MainWindowHandle, 2) If you add that to the start of your scripts it hides the window via win32api. At least then you don't have to just disable Windows Terminal in your organisation to get around this. Although that said it depends how many scripts you have that run as the user, if it's pheasable to add that script to all of them. |
Yeah, many thanks for that, i already use a C# app for hide console if needed, but... It's still bugged in "Windows Terminal" and so it is up to them to fix this in the Terminal Code! You can Block me or set anything to Off-topic as often as you want... |
Hey @zadjii-msft! Now that we merged tearoff plus #14944 and #13478, we might have the right underpinnings to let console applications "hide" their windows. Mini-proposal (which should be fleshed out into a spec): A console application that hides its window should be detached from the pane/tab it's in and moved to a new tab in a hidden window. That window can show up in the tray icon list of windows, and users can show them if they want, but we won't have to present UI for it. If that console app was already the only tenant in a window (no panes/tabs), we could just mark that one hidden. |
That's the first real proposal to SW_HIDE that makes sense to me for a tabbed application. Though, here's a possible problem:
so we'd need to special case that too |
Hi DHowett |
Request: Since all DHowett's idea makes the most sense to me: Hide the tab, and I'm with KG-droid, if we wanted users to mess with the window, we'd minimize it. |
This important detail should be added to the documentation, since it still just mentions using --no-console as though it will work in modern Windows versions. |
Windows Terminal version
1.12.10393.0
Windows build number
Microsoft Windows NT 10.0.22549.0
Other Software
Steps to reproduce
Set Windows Terminal as the default terminal application:
.
Make sure to save changes to Windows Terminal Settings, and then using Windows Run, run
pwsh -WindowStyle Hidden -Command Sleep 10
:Expected Behavior
A new PowerShell process launches (Windows Terminal), and it isn't visible. The window may flash for a second. PowerShell window shouldn't be displayed when it's launched with
WindowStyle -Hidden
.Actual Behavior
A new PowerShell process launches (on Windows Terminal), and it is visible and remains visible (and waits) for 10 seconds.
Note: There is no repro for this issue with
Windows Console Host
as the default terminal application.The text was updated successfully, but these errors were encountered: