Disassembler0 / Win10-Initial-Setup-Script

PowerShell script for automation of routine tasks done after fresh installations of Windows 10 / Server 2016 / Server 2019
MIT License
4.7k stars 1.07k forks source link

3.4 | Hide shortcut icon arrow #186

Closed AnubisMann closed 5 years ago

AnubisMann commented 5 years ago

When I apply the script to hide the arrows of the icons, when restarting the PC the image of the icons disappears and only the letters are seen.

Disassembler0 commented 5 years ago

Do you have any files with names starting with iconcache under %LocalAppData%\Microsoft\Windows\Explorer ? If so, please delete them and then restart explorer.exe via task manager. It should trigger cache reload.

AnubisMann commented 5 years ago

The same thing still happens, it is something of the script, since with another program I eliminate the arrows without problem in the images of the icons, attached image.

sin titulo

AnubisMann commented 5 years ago

You have to add a function in the script to restart the Explorer, which makes it automatic. The program that works for me to eliminate the arrows and that restarts the browser is called "WindowsShortcutArrowEditor".

Do you have any files with names starting with iconcache under %LocalAppData%\Microsoft\Windows\Explorer ? If so, please delete them and then restart explorer.exe via task manager. It should trigger cache reload.

You have to add a function in the script to restart the Explorer, which makes it automatic. The program that works for me to eliminate the arrows and that restarts the browser is called "WindowsShortcutArrowEditor".

Disassembler0 commented 5 years ago

You have to add a function in the script to restart the Explorer, which makes it automatic.

I kinda expect that a reboot will follow after the script finishes, which would make this unnecessary. But this isn't the first time I'm hearing about similar problems and I hoped that the cache cleanup added in https://github.com/Disassembler0/Win10-Initial-Setup-Script/commit/24a1c79d584d860959dbd44afbf502783227947d fixes this (worked on my machine), so I'll check how the tool you've mention does it.

AnubisMann commented 5 years ago

You have to add a function in the script to restart the Explorer, which makes it automatic.

I kinda expect that a reboot will follow after the script finishes, which would make this unnecessary. But this isn't the first time I'm hearing about similar problems and I hoped that the cache cleanup added in 24a1c79 fixes this (worked on my machine), so I'll check how the tool you've mention does it.

This is the link of the tool that works well with the arrows of the icons: https://winaero.com/comment.php?comment.news.156

Disassembler0 commented 5 years ago

The tool does the exact same thing with the exact same registry key, except it carries its own blank icon as replacement instead of using the blank one from %windir%\System32\shell32.dll,-50. I have added the explorer restart, could you please download the latest master and reapply the tweak to see if that helped?

AnubisMann commented 5 years ago

The tool does the exact same thing with the exact same registry key, except it carries its own blank icon as replacement instead of using the blank one from %windir%\System32\shell32.dll,-50. I have added the explorer restart, could you please download the latest master and reapply the tweak to see if that helped?

Downloading the new file remains the same, the only way to restore the images of the icons again is by using "WindowsShortcutArrowEditor" and selecting "Windows Default".

Disassembler0 commented 5 years ago

So just to have a clear picture of what's going on...

  1. You have started with working icons with the default arrow image.
  2. You have downloaded the latest master and applied at least RequireAdmin and HideShortcutArrow tweaks.
  3. The explorer has been restarted as part of HideShortcutArrow tweak (the whole desktop disappeared and reappeared a second or two later) and right after that, all your shortcut icons were immediately black/missing.
  4. When instead of applying HideShortcutArrow you use WindowsShortcutArrowEditor or Winaero Tweaker, set "No arrow" and restart the explorer using the button in the tool, the icons are visible without the arrow as expected.

Is that correct?

AnubisMann commented 5 years ago

So just to have a clear picture of what's going on...

  1. You have started with working icons with the default arrow image.
  2. You have downloaded the latest master and applied at least RequireAdmin and HideShortcutArrow tweaks.
  3. The explorer has been restarted as part of HideShortcutArrow tweak (the whole desktop disappeared and reappeared a second or two later) and right after that, all your shortcut icons were immediately black/missing.
  4. When instead of applying HideShortcutArrow you use WindowsShortcutArrowEditor or Winaero Tweaker, set "No arrow" and restart the explorer using the button in the tool, the icons are visible without the arrow as expected.

Is that correct?

Correct

Disassembler0 commented 5 years ago

Alright. The only difference is the icon itself. I'm starting to suspect some more esoteric problems. Access rights, color depths, incompatibility between graphic drivers and DIB engine or something specific to your (and bunch of others) setup. I'd like to ask you to help me debug.

1) HideShortcutArrow is not included in the default preset. Send me please your customized preset, maybe there is a conflict with another tweak.

2) When you have successfully hidden the arrow using WindowsShortcutArrowEditor or Winaero Tweaker and then apply ShowShortcutArrow, does it work as expected and shows the arrow?

3) Please try to run this in elevated PowerShell

    Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" -Name "29" -Type ExpandString -Value "%SystemRoot%\System32\shell32.dll,-50"
    Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue
(uses `ExpandString` type instead of `String` and `%SystemRoot%` instead if `%WinDir%`)

4) If that doesn't work, try running:

    Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" -Name "29" -Type String -Value "%SystemRoot%\System32\shell32.dll,-44"
    Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue
That should show you a yellow star icon in place where the shortcut arrow would normally be.

5) If that doesn't work, download this archive - icons.zip - it contains 2 icon files, one with 16 color palette and the other with 32-bit (RGBA) color palette. Extract it and then edit the path on the first line below and run

    Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" -Name "29" -Type String -Value "C:\Path\To\The\Icon.ico"
    Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue
Try it first for the 16 color, then for RGBA.
AnubisMann commented 5 years ago

HideShortcutArrow I use it from the preset by default.

Default.zip

Disassembler0 commented 5 years ago

I've tried your preset on 3 distinct machines (2 VMs, 1 physical) and got no issues anywhere. Let me know when you test the rest.

Ozgood commented 5 years ago

Look at your private e-mail "disassembler@dasm.cz" from October 30th. There I have reported nearly the same - disappearance of icon images. In case of interest call me at 602 535 034. BR Ivo

Disassembler0 commented 5 years ago

Yeah, you were what I've meant by But this isn't the first time I'm hearing about similar problems... :)

Unfortunately you didn't provide anything tangible to investigate either and you've mentioned that after some time the icons just magically reappeared, which makes even less sense.

If you're willing to help with the debugging, please try the same steps 2 - 5 as above.

AnubisMann commented 5 years ago

The error continues after reinstalling Windows completely, it only works well with the "Windows Shortcut Arrow Editor" application. This problem occurs to me in Windows 10 1809 October 17763.195 (second version fix of 1809 October).

Disassembler0 commented 5 years ago

That doesn't help in narrowing down the causes. Windows Shortcut Arrow Editor supplies its own icon. That would map to step 5 (above) with RGBA. That's why I need you to go through the steps to get some hopefully meaningful results. I'd do it myself but I don't have any setup which would exhibit the same problems.

AnubisMann commented 5 years ago

That doesn't help in narrowing down the causes. Windows Shortcut Arrow Editor supplies its own icon. That would map to step 5 (above) with RGBA. That's why I need you to go through the steps to get some hopefully meaningful results. I'd do it myself but I don't have any setup which would exhibit the same problems.

The Ozgood user who posted above happens the same as me and if the other application does not happen the same thing is obvious that something is wrong in your script ... Windows 1809 there are 2 versions, the last of October is fixed version.

Disassembler0 commented 5 years ago

I'm aware that there is something wrong in my script. I'm asking for help with finding out what exactly as I'm unable to replicate it. If you're not willing, then I have no other option than simply to tell you to not use that tweak, which is hardly a solution.

AnubisMann commented 5 years ago

I'm aware that there is something wrong in my script. I'm asking for help with finding out what exactly as I'm unable to replicate it. If you're not willing, then I have no other option than simply to tell you to not use that tweak, which is hardly a solution.

If so you treat the users of your script, better use another ... The arrogance is not good, if another user tells you the same thing that I am because the script is wrong and I will not do all those instructions when I told you that I just to install Windows 1809 right now and the same error occurs.

Disassembler0 commented 5 years ago

Arrogance? I understand that there are at least 2 user for which it doesn't work. I understand that there is a tool which does the same which does work. The tool is not opensource, so I can't simply copy whatever it is doing and therefore I need to find how to do it in publicly accessible way. What do you expect me to do?

AnubisMann commented 5 years ago

Arrogance? I understand that there are at least 2 user for which it doesn't work. I understand that there is a tool which does the same which does work. The tool is not opensource, so I can't simply copy whatever it is doing and therefore I need to find how to do it in publicly accessible way. What do you expect me to do?

Windows Shortcut Arrow Editor.zip

Ozgood commented 5 years ago

This doesn´t implicate that the rest has no problem because me and AnubisMann are probably the only two guinea pigs who hate shortcut icon arrows so much so performed this particular tweak.

Still running with W10 Pro1803 build 17134.472 kept updated. For clarifying my issue - immediately after the registry writing by the tweak - arrows vanished, but after the ending restart - the whole icon is replaced by black image. If I resize icons to bigger ones black image stay the same size and behind is seen the rest of original icon image. There is no way using win tools to remedy this situation. I really don´t know why, after several sleep and awake cycles, without my intervention, system itself "repaired" and icons were right and without arrows. This state lasts till some internal problem inside wins occured and wins silently and without giving any information about it simply started some older copy. Blacked icons appeared again. So I checked the registry item and simply deleted the appropriate key with value -50. So now I have icons with arrows again and knowledge that something smells inside win10.

AnubisMann commented 5 years ago

This doesn´t implicate that the rest has no problem because me and AnubisMann are probably the only two guinea pigs who hate shortcut icon arrows so much so performed this particular tweak.

Still running with W10 Pro1803 build 17134.472 kept updated. For clarifying my issue - immediately after the registry writing by the tweak - arrows vanished, but after the ending restart - the whole icon is replaced by black image. If I resize icons to bigger ones black image stay the same size and behind is seen the rest of original icon image. There is no way using win tools to remedy this situation. I really don´t know why, after several sleep and awake cycles, without my intervention, system itself "repaired" and icons were right and without arrows. This state lasts till some internal problem inside wins occured and wins silently and without giving any information about it simply started some older copy. Blacked icons appeared again. So I checked the registry item and simply deleted the appropriate key with value -50. So now I have icons with arrows again and knowledge that something smells inside win10.

For the arrows, I only work well with this program: Windows Shortcut Arrow Editor.zip

Disassembler0 commented 5 years ago

Alright. This

If I resize icons to bigger ones black image stay the same size and behind is seen the rest of original icon image.

is actually really useful piece of information as it points to the icon cache and alpha channel processing. Thanks to this I was able to replicate the problem by setting the icon from shell32, purging the icon cache and then restarting explorer. Or at least I expect it's the same problem. It looks like this: black

That means that the icon absolutely needs to have 32bit (RGBA) color space and this is the reason why the Windows Shortcut Arrow Editor and Winaero Tweaker carries their own which has it, as opposed to the one from shell32 which has just 16 colors (with no alpha channel).

So now I need to figure out where to find an empty icon with RGBA color space as I'm not willing to bundle one with the script.

Disassembler0 commented 5 years ago

OK, found one which seems to work across all build and editions. Try this, please:

If (!(Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons")) {
    New-Item -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" | Out-Null
}
Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Icons" -Name "29" -Type String -Value "%SystemRoot%\System32\imageres.dll,-1015"
Stop-Process -Name "explorer" -Force -ErrorAction SilentlyContinue

If you confirm that there are no issues with this one, I'll fix it also in the master branch.

Ozgood commented 5 years ago

I was performing only tasks around "tweaks" and something went wrong with Edge. Green buton Comment changed its brightness and Adblock disappeared from Edge and cannot be installed again. I restarted copm and now Adblock is present in Edge again but my last statement here in Github is lost.

I have just put this new item into Win10.psm1 and run the Hide… tweak. And Edge is now the only visible part of screen. The screen behind Egde window (and all other windows) are cowered with black and there are nothing else to be activated by clicking on. System is completely blind and me too.

Ozgood commented 5 years ago

help me please - how to start regedit if I can only use this conversation in Edge.

Ozgood commented 5 years ago

Well, I´m back again. Successfully edited registry back to -50 key value, reset, and now screen ok again and icons without arrows. The key "imagers.dll, -1015" seems not to be the good idea.

AnubisMann commented 5 years ago

I hope it is solved for 3.5 version of the script.

Disassembler0 commented 5 years ago

Resolved in TeamViewer session with @Ozgood. Many thanks for that.

RGBA icon indeed seems to work properly, so I've pushed it in 6ce0765. The rest of the problems mentioned (black screen) were likely caused by explorer being killed twice in fast succession, so Windows decided not to respawn it again.

AnubisMann commented 5 years ago

Resolved in TeamViewer session with @Ozgood. Many thanks for that.

RGBA icon indeed seems to work properly, so I've pushed it in 6ce0765. The rest of the problems mentioned (black screen) were likely caused by explorer being killed twice in fast succession, so Windows decided not to respawn it again.

The modified file is now inside in the .zip release 3.4?

Disassembler0 commented 5 years ago

Right now it's only in current master branch zip - https://github.com/Disassembler0/Win10-Initial-Setup-Script/archive/master.zip

It will be in 3.5 once I draft a new release. I plan to do it tomorrow.