Shortly after installing msysgit on my box I saw that my console windows were shown with Git’s icon on the taskbar. Some checking revealed that only 32-bit cmd.exe placed in the SysWOW64 folder had icon replaced. No matter how you run cmd.exe from 32-bit process (namely I run it most often from Total Commander) you see Git’s icon.
After an hour of trials and errors I found that it is due to mere existing of shortcut file in the start menu. Wow!
The shortcut was to Git Bash and it has this line as a Target:
C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i"
Icon was changed to Git’s one (actually it was the way I discovered this file). When I renamed it to something like “*.lnk_” or changed target to any other executable – cmd.exe obtains its rightful icon back. It’s worth to mention that other places of my hard drive still had links to cmd.exe with Git’s icon, but this fact didn’t influence cmd.exe. Only shortcut in start menu did.
So I decided to check what happens if I would have two shortcuts with different icons there? 🙂 And so I created new shortcut to cmd.exe in the same place. Now cmd.exe has own icon and Git Bash has its icon, everybody is happy.
With some additional experiments I found that which shortcut selected to get icon properties from depends on parameter list in the first place. And if param list of both shortcuts is equal – selection is made by lexical order of shortcuts’ filenames – e.g. if one named a.lnk and another b.lnk – cmd.exe will have icon set in a.lnk.
I don’t understand this behavior of Windows (I have Win7 x64 Ultimate with SP1 installed by the way) but it is as is how EULA explicitly mentions.