how do I programmatically change icon of a Windows executable and Mac application?

Question!

When distributing standalone applications built on node-webkit or Atom Shell, we are really just distributing the framework binary but with our application content in a subdirectory.

We can of course rename the executables to our Application's name, but can we also change the icon (preferably from the command line for automating a release workflow)?



Answers

There are solutions for doing this from the command line in both Mac and Windows.

Mac

defaults write /full/path/to/Info.plist CFBundleIconFile 'app/img/my-icon.icns'

Windows

Requires winresourcer

  winresourcer --operation=Update \
           --exeFile=path/to/my-exe.exe \
           --resourceType=Icongroup \
           --resourceName:1 \
           --resourceFile:path/to/my-icon.ico

To find the resourceName, use Anolis Resourcer to open the exe. The name is found on the sidebar as the child element of Icon Directory. In my case, it was simply called 1.



This video can help you solving your question :)
By: admin