Skip to content
⌘ NSIS Forum Archive

Kill then restart explorer.exe

3 posts

Mircea M#

Kill then restart explorer.exe

Hi,

due to a change in the icon of our application in the new version, I need to rebuild the Windows icon cache. Deleting the IconCache.db file works but in order to show the new icon to the user immediately, I need to restart the explorer.exe process. Again, killing it is no problem but when I want to restart it, instead of getting the start menu, desktop, etc. back, I only get a Windows Explorer window.

If I restart the process manually (Task Manager -> File -> new Task -> explorer.exe), the desktop, start menu and new icons are there.

Any idea how to achieve this through the installer?

Here's my code:

Function IconCacheRebuild
ExecWait "taskkill /F /IM explorer.exe"
Delete "$LOCALAPPDATA\IconCache.db"
ExecWait "explorer.exe"
FunctionEnd
Thanks!
JasonFriday13#
Try this:

!define SHCNE_ASSOCCHANGED 0x8000000
!define SHCNF_IDLIST 0

System::Call 'Shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_IDLIST}, p0, p0)'