0

I like to have a set of standard apps that are pinned when I install Windows, and I like to automate that (currently using syspin as I don't have a method in PowerShell). My problem is that some pinned items open integrated with the program and some do not.

e.g. here are my pinned apps. enter image description here And here is Notepad++ open, notice that the pin has disappeared as it integrates with the open program enter image description here

But, Visual Studio Code here when open, the pin is left where it is, and the open program is a separate item. I've no idea why Windows does this. Is there a way to use PowerShell to pin items to the Taskbar such that they always integrate when opening? enter image description here

YorSubs
  • 669
  • 7
  • 23

2 Answers2

0

The programs whose icons don't "integrate" are usually just different programs.

This happens when the pinned item launches a second program. The two programs might present the same icon, but the icons cannot merge, because the programs are different.

If the problem is with having two identical icons on the taskbar, you can change the icon of the pinned item.

See the article Changing Taskbar Icon for Applications on Windows 10. In my testing it was required to relaunch explorer.exe via Task Manager, by killing it and then running again using the menu File > Run new task.

harrymc
  • 455,459
  • 31
  • 526
  • 924
  • Definitely not different programs. I only have one copy of `code.exe` and it resides in my Microsoft Visual Studio Code folder. I have also been looking around for ways to pin items to the taskbar with PowerShell, but every solution seems to be broken (I guess that Microsoft changed something in the OS; I put a notice up on this page to point out that these answers are all broken). https://stackoverflow.com/questions/31720595/pin-program-to-taskbar-using-ps-in-windows-10/74205500#74205500 – YorSubs Oct 26 '22 at 09:32
  • Even a new invocation of the same `.exe` is a different program. You could use [Process Monitor](https://learn.microsoft.com/en-us/sysinternals/downloads/procmon) to verify what happens, but try first to simply watch through the Task Manager. – harrymc Oct 26 '22 at 09:40
  • Sure, but you see in my answer what happens with Notepad++ right? There could be something in what you are saying, but when I open Notepad++ it integrates perfectly into the existing Taskbar icon. You see the specific difference: for Notepad++, the first opening integrates into the existing icon, but for VS Code, the first opening does NOT integrate into the existing icon. It's quite notable (and quite weird) that they act differently like this. – YorSubs Oct 26 '22 at 09:57
  • I think I need to explain it better (as it is confusing, I don't understand why this happens). There is only a *single* invocation of VS Code, but then I end up with the original pinned item *and* the open program as separate entities on the Taskbar, while Notepad++ acts differently. A single invocation of that integrates with the Taskbar icon. I've seen this on and off over the last 10 years with Windows, but I don't know the solution. – YorSubs Oct 26 '22 at 10:13
  • Notepad++ doesn't launch any secondary processes, so it uses only one icon. VS Code is much more complex. – harrymc Oct 26 '22 at 13:20
  • True. Problem is that they *act* differently, but 100% of users probably just want them to pin in the same way (there is no "user advantage" that I can see to this odd/confusing behaviour). Hopefully someone who knows how to make all apps pin in a consistent manner might provide a comprehensive solution to this in PowerShell at some point. At least for now, I know a manual cludge/hack to address the issue when I see it (which is better than nothing). – YorSubs Oct 26 '22 at 13:48
  • Your workaround seems like too much bother - two icons is not so bad. This isn't the first such post I've answered and there is no real solution. I added to my answer how to distinguish visually between the two icons. – harrymc Oct 26 '22 at 13:59
  • Ah, that's technically a different issue from the one I am facing. I only have one app (bog standard VS Code) whereas the person in the linked page page has two distinct apps. I like to believe that everything can be (or *should be able to be*) automated, so it annoys me when MS do things like this. On that link, that person describes a good way to distinguish them (though I would use `WScript.Shell` and change the `.IconLocation` on the second shortcut probably). It's a good link though, as similar / related issue, hopefully this can help others with similar problems. – YorSubs Oct 26 '22 at 14:46
0

Some applications simply do not "play nice" with being pinned to the Taskbar (some API issue), but there is a workaround. For example Notepad++ integrates easily every time, but File Explorer, Microsoft Edge, Brave, Visual Studio Code (and many others) do not.

To test this, unpin them from the Taskbar, then drag a shortcut or the executable onto the Taskbar to pin it, and for misbehaving apps, you will get duplicate icons when opening that app.

Reason 1 in this link is the cause, and applies whether I drag a shortcut or executable onto the Taskbar (i.e. proving that Reason 2 is not the cause). Some taskbar pinned icons are duplicated when an instance of the application is running

The "Temporary Solution" listed there works. "Open the program, so that you have duplicate icons, then right click the duplicate icon (the new one) and "Pin to taskbar", then right-click the original and select Unpin this program from taskbar, then there will only be one pinned item from now on."

However, I don't really regard this as a proper solution, as it's a nuisance to have to do this and as yet, sadly, I do not have a way automate a fix for this (11+ year old issue, going by the date of the linked answer). If anyone has a way in PowerShell to properly pin items, that would be appreciated (note that all answers that use this method of pinning are completely broken, none of the answers on here work since 2019. https://stackoverflow.com/questions/31720595/pin-program-to-taskbar-using-ps-in-windows-10/74205500#74205500)

YorSubs
  • 669
  • 7
  • 23