You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Area-WindowingWindow frame, quake mode, tearoutHelp WantedWe encourage anyone to jump in on these.Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-3A description (P3)Product-ConhostFor issues in the Console codebase
I don't know if this has anything to do with conhost, but I can't think of a better place to ask "What's going on here?".
If I give this command to CMD, start "C:\WINDOWS\system32\notepad.EXE" cmd, I get a new instance of CMD in a console with notepad's icon. Why does specifying a title affect the icon?
The logic there seems somewhat odd though; the comment talks about searching "along the path" but the code calls SearchPathW with only pwszCurrDir as the path.
Plus it uses sizeof(wszIconLocation) in two comparisons where ARRAYSIZE would be correct. Filed as #11761.
I can imagine trying to get an icon from STARTUPINFO::lpTitle if STARTUPINFO::dwFlags contains STARTF_TITLEISLINKNAME (or maybe even STARTF_TITLEISAPPID). Otherwise it makes no sense to me. I wouldn't call it a feature.
Of STARUPINFO::lpTitle, the docs say
For console processes, this is the title displayed in the title bar if a new console window is created.
In fact, the code posted by Kalle Olavi Niemitalo (@KalleOlaviNiemitalo) is done outside the if (pLinkSettings->GetStartupFlags() & STARTF_TITLEISLINKNAME) block. It doesn't seem right. It's just a title.
I assume it is a counterpart to some code in cmd.exe or kernelbase.dll that uses the file name as the window title. Which then makes me wonder if the "Administrator:" prefix can make this not find the correct icon. Perhaps not, because it still has pwszAppName.
Back to my first post ... setting the icon to that of notepad is just plain wrong. It's a title. It is not a specification of where to look for an icon.
honestly, I'm not sure anyone on the team is going to have an answer as to why. This is gonna be one of those "features" of the console that's simply always existed, since before we formally owned the console codebase. I don't think we'd really have an answer other than "Huh, yep, it sure does seem to do that".
I'd be extremely reluctant to change that, undoutably someone somewhere is relying on that behavior to set the icon of their console windows for some reason.
The funny thing is that way back when we had SEE_MASK_ICON for ShellExecuteEx and I believe it was used to change the console icon but that has not worked for a very long time, NT4 was maybe the last time it actually did anything. Going back even further, Progman in 16-bit Windows had a undocumented way of assigning icons (STARTUPINFO still has a member for it).
I wish I had more Windows versions to test on.
Windows 8.1 does not use the icon from the title path.
The console currently uses the "title" as a fallback location to load the icon from, which can be weird.
The console does that as of 2017, seemingly to help support WSL distros.
This creates a new bug where start "C:\WINDOWS\system32\notepad.EXE" cmd now loads notepad's icon, because we're using the title as a potential icon search path.
(TODO) I don't know off hand if there's a better way to support the icons in the WSL distro case (app execution aliases)
Did I miss anything? I'm down in these weeds as a part of #9458, so this is a prime opportunity to resolve this, if resolvable at all.
If I open Windows Terminal first then select some predefined profile to open my WSL, it shows correct icon. But if I open corresponding distro xxx.exe, it launches in Windows Terminal without icon, like this:
And the profile command line is just set as the distro exe.
I've tested 2 distros and both of them show wrong icon. Maybe this is related with Windows Terminal?
I think this is (unfortunately) unrelated to the current issue. However, I'll suggest checking out the icon field in your opensuse-tumbleweed profile settings.
Apologies first if I misunderstanding current issue 😢
I've set the Icon field. If I start Windows Terminal first then it shows correct icon like this:
But if I start Ubuntu directly from start menu, it shows wrong icon:
* [ ] (**TODO**) I don't know off hand if there's a better way to support the icons in the WSL distro case (app execution aliases)
Does WT use openconsole/conhost under the hood? If not, we could revert the behaviour regressed just for WSL support from conhost/openconsole? As anyone on WSL would also be on WT imo..
I've set the Icon field. If I start Windows Terminal first then it shows correct icon like this:
But if I start Ubuntu directly from start menu, it shows wrong icon:
Area-WindowingWindow frame, quake mode, tearoutHelp WantedWe encourage anyone to jump in on these.Issue-BugIt either shouldn't be doing this or needs an investigation.Priority-3A description (P3)Product-ConhostFor issues in the Console codebase
Activity
KalleOlaviNiemitalo commentedon Nov 15, 2021
Seems to be a deliberate feature:
terminal/src/interactivity/win32/SystemConfigurationProvider.cpp
Lines 172 to 188 in 7b77568
The logic there seems somewhat odd though; the comment talks about searching "along the path" but the code calls SearchPathW with only pwszCurrDir as the path.
Plus it uses sizeof(wszIconLocation) in two comparisons where ARRAYSIZE would be correct. Filed as #11761.
vefatica commentedon Nov 15, 2021
I can imagine trying to get an icon from STARTUPINFO::lpTitle if STARTUPINFO::dwFlags contains STARTF_TITLEISLINKNAME (or maybe even STARTF_TITLEISAPPID). Otherwise it makes no sense to me. I wouldn't call it a feature.
Of STARUPINFO::lpTitle, the docs say
That hardly tells the whole story.
elsaco commentedon Nov 15, 2021
Vincent Fatica (@vefatica) if you remove the extension, the icon won't be displayed:
I don't have the knowledge why it behaves like that!
vefatica commentedon Nov 15, 2021
In fact, the code posted by Kalle Olavi Niemitalo (@KalleOlaviNiemitalo) is done outside the
if (pLinkSettings->GetStartupFlags() & STARTF_TITLEISLINKNAME)block. It doesn't seem right. It's just a title.KalleOlaviNiemitalo commentedon Nov 15, 2021
I assume it is a counterpart to some code in cmd.exe or kernelbase.dll that uses the file name as the window title. Which then makes me wonder if the "Administrator:" prefix can make this not find the correct icon. Perhaps not, because it still has pwszAppName.
vefatica commentedon Nov 15, 2021
Back to my first post ... setting the icon to that of notepad is just plain wrong. It's a title. It is not a specification of where to look for an icon.
zadjii-msft commentedon Nov 15, 2021
honestly, I'm not sure anyone on the team is going to have an answer as to why. This is gonna be one of those "features" of the console that's simply always existed, since before we formally owned the console codebase. I don't think we'd really have an answer other than "Huh, yep, it sure does seem to do that".
I'd be extremely reluctant to change that, undoutably someone somewhere is relying on that behavior to set the icon of their console windows for some reason.
vefatica commentedon Nov 15, 2021
Maybe so, but it doesn't happen in Windows 7. I wish I had more Windows versions to test on.
That's humorous.
zadjii-msft commentedon Nov 15, 2021
When you've been here as long as us, you can be 100% sure that someone, somewhere, is relying on all sorts of wacky bugs in your codebase 😄
23 remaining items
sredna commentedon Dec 9, 2021
The funny thing is that way back when we had
SEE_MASK_ICONfor ShellExecuteEx and I believe it was used to change the console icon but that has not worked for a very long time, NT4 was maybe the last time it actually did anything. Going back even further, Progman in 16-bit Windows had a undocumented way of assigning icons (STARTUPINFO still has a member for it).Windows 8.1 does not use the icon from the title path.
jredfox commentedon May 19, 2022
zadjii-msft commentedon Jul 19, 2022
Hmmm. Okay, so breaking this thread down:
start "C:\WINDOWS\system32\notepad.EXE" cmdnow loads notepad's icon, because we're using the title as a potential icon search path.Did I miss anything? I'm down in these weeds as a part of #9458, so this is a prime opportunity to resolve this, if resolvable at all.
LinHeLurking commentedon Oct 20, 2022
DHowett commentedon Oct 20, 2022
LinHeLurking commentedon Oct 21, 2022
Apologies first if I misunderstanding current issue 😢
I've set the

Iconfield. If I start Windows Terminal first then it shows correct icon like this:But if I start Ubuntu directly from start menu, it shows wrong icon:

NewtonChutney commentedon Jan 5, 2024
Does WT use openconsole/conhost under the hood? If not, we could revert the behaviour regressed just for WSL support from conhost/openconsole? As anyone on WSL would also be on WT imo..
LinHeLurking, this is related to: #12582 #12755