发布时间:2025-12-09 11:49:51 浏览次数:1
其实各种打包模块都有相关的文档说明,相关链接如下:
electron-builder:https://www.electron.build/icons.html
electron-packager: https://electron.github.io/electron-packager/main/interfaces/electronpackager.options.html#icon
windows 和 macos 的 图标都是复合格式,包含了多种尺寸和颜色模式,Linux 就是多张png,electron 例子里就多各种尺寸。PS:不要把png直接改成 ico。
windows :.ico 文件,下图为 iConvert Icons 的默认设置。
macos:.icns 文件,下图为 iConvert Icons 的默认设置。
iConvert Icons、icoFx、AppIcon Generator、MakeAppIcon 等。
将下面的内容保存成 bat 文件,执行就可以。PS:有可能需要以管理员权限执行。
rem 关闭Windows外壳程序explorertaskkill /f /im explorer.exerem 清理系统图标缓存数据库attrib -h -s -r "%userprofile%\AppData\Local\IconCache.db"del /f "%userprofile%\AppData\Local\IconCache.db"attrib /s /d -h -s -r "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\*"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_32.db"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_96.db"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_102.db"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_256.db"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_1024.db"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_idx.db"del /f "%userprofile%\AppData\Local\Microsoft\Windows\Explorer\thumbcache_sr.db"rem 清理 系统托盘记忆的图标echo y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v IconStreamsecho y|reg delete "HKEY_CLASSES_ROOT\Local Settings\Software\Microsoft\Windows\CurrentVersion\TrayNotify" /v PastIconsStreamrem 重启Windows外壳程序explorerstart explorer