Windows 7 上的桌面快捷方式图标错误 (Inno Setup)

发布于 2024-10-06 17:03:36 字数 780 浏览 0 评论 0原文

我已经使用 Inno Setup 创建了一个安装程序。用于桌面快捷方式和开始菜单的图标嵌入在应用程序可执行文件中。

最初创建安装程序时,我没有设计团队提供的最终产品图标。当我完成安装程序时,我使用了一个临时图标。

一切都按预期进行,直到我更改了最后一个图标。现在,桌面快捷方式和开始菜单图标始终显示旧图标,即使其他地方的图标都是正确的。

这是脚本的图标声明部分。

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; WorkingDir: {app}
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; IconFilename: {app}\Icons\stop.ico
Name: {commondesktop}\{#MyAppVersionName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; WorkingDir: {app}

这是我尝试过的:(这是 Windows 7 系统)

如果我查看快捷方式属性,并选择“更改图标”,我会看到正确的图标。重新选择没有效果。我还尝试选择一个不相关的图标,然后重新选择正确的图标...仍然显示旧图标。

我已按照建议删除 IconCache.db 并重新启动计算机,但这也没有效果。

旧图标到底来自哪里?它不在安装程序中。

有人有想法吗?

I have created an installer with Inno Setup. The icon used for the desktop shortcut and start menu is embeded in the application executable.

When the installer was initially created, I didn't have the final product icon from the design team. I used a temporary icon instead as I completed the installer.

Everything worked as it should until I changed the icon for the final one. Now the desktop shortcut and start menu icons always display the old icon even though everywhere else the icon is correct.

This is the Icon declaration section of the script.

[Icons]
Name: {group}\{#MyAppName}; Filename: {app}\{#MyAppExeName}; WorkingDir: {app}
Name: {group}\{cm:UninstallProgram,{#MyAppName}}; Filename: {uninstallexe}; IconFilename: {app}\Icons\stop.ico
Name: {commondesktop}\{#MyAppVersionName}; Filename: {app}\{#MyAppExeName}; Tasks: desktopicon; WorkingDir: {app}

Here's what I've tried: (This is a Windows 7 system)

If I look at the shortcut properties, and choose "change icon" I see the correct icon. Re-selecting it has no effect. I've also tried selecting a dis-related icon and then re-selecting the correct on... still shows the old one.

I've followed suggestions to delete the IconCache.db and restarting the machine but this has no effect either.

Where in the world is the old icon coming from? It's nowhere in the installer.

Ideas anyone?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

面如桃花 2024-10-13 17:03:36

看来这确实与 IconCache.db 文件有关。我只能猜测有些事情没有按正确的顺序完成(尽管我多次尝试了不同的程序)。

以下是我手动执行重置的方法:

  • 单击开始按钮 >按住 Ctrl+Shift &右键单击“开始”菜单中的空白区域。
  • 选择“退出资源管理器”。
  • 按住 Ctrl+Shift+Esc 键打开任务管理器。
  • 选择“文件”> “新任务”。
  • 键入:cmd(然后按 Enter)。这将打开命令提示符。
  • 类型:cd /d %userprofile%\AppData\Local(然后按 Enter
  • 类型:attrib –h IconCache.db(然后按 < kbd>Enter)
  • 输入:del IconCache.db(然后按 Enter
  • 输入:start explorer(然后按 输入

现在一切都按其应有的方式呈现。

It seems that this indeed was related to the IconCache.db file. I can only guess that something wasn't done in the right order (though I tried differing procedures more than once).

Here's how I performed the reset manually:

  • Click Start button > Hold down Ctrl+Shift & Right Click on empty area in the Start Menu.
  • Select "Exit Explorer".
  • Hold Ctrl+Shift+Esc keys to open Task Manager.
  • Select "File" > "New Task".
  • Type: cmd (and press Enter). This will open the command prompt.
  • Type: cd /d %userprofile%\AppData\Local (and press Enter)
  • Type: attrib –h IconCache.db (and press Enter)
  • Type: del IconCache.db (and press Enter)
  • Type: start explorer (and press Enter)

Now everything renders just as it should.

霞映澄塘 2024-10-13 17:03:36

正如 swirlywonder 的回答一样,这个批处理脚本应该自动执行该过程:

rebuild-icon-cache.bat

@echo off
taskkill /IM explorer.exe /F
cd /d %userprofile%\AppData\Local
del IconCache.db /a
start explorer.exe

As in swirlywonder's answer, this batch script should automate the process:

rebuild-icon-cache.bat

@echo off
taskkill /IM explorer.exe /F
cd /d %userprofile%\AppData\Local
del IconCache.db /a
start explorer.exe
温馨耳语 2024-10-13 17:03:36

有一个更好的方法。在安装程序中发送单独的 .ico 文件,然后
使用 [Icons] 部分中的 IconFilename 参数来定位该图标而不是 exe 中的图标。

There is a better way. Ship separate .ico file within your installer, and then
use IconFilename parameter in [Icons] section to target that icon instead of the one in the exe.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文