Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add icon to existing EXE file from the command line [closed]

Is there a command line tool that can add an icon to an existing executable file? It should be able to set the icon as the file's "main" icon that is shown in Explorer.

I don't have Visual Studio and cannot recompile the exe with custom resources containing the icon.

UPDATE: The best tool I have found since posting this question is by far the RCEDIT.exe utility that is included with WinRun4J.

like image 587
Tomas Andrle Avatar asked Mar 23 '09 12:03

Tomas Andrle


People also ask

How do I add a logo to an EXE file?

In the Resource Hacker window, select the “Icon” folder in the left pane. Click the “Action” menu and then select “Replace Icon.” In the Replace Icon window, click the “Open file with new icon” button and browse to the location of the icon you want to use. The source can be an EXE, DLL, RES, or ICO file.

How do I add an icon to exe in PyInstaller?

To change the icon that the .exe has, you can pass the --icon=icon. ico to the pyi-makespec command or modify the . spec file yourself by altering the exe object to add the argument icon='icon.

Can you run an EXE file from command prompt?

Type "start [filename.exe]" into Command Prompt, replacing "filename" with the name of your selected file. Replace "[filename.exe]" with your program's name. This allows you to run your program from the file path.


2 Answers

Sorry, I haven't personally tried this one just yet, but because I am wanting this while bundling up an atom-shell app, I found it very interesting when https://github.com/atom/rcedit showed up in my first search for the RCEDIT utility mentioned in other answers.

One of its commands is:

$ rcedit "path-to-exe-or-dll" --set-icon "path-to-ico"

…so assuming this works, it is likely the solution I will use — my Windows build machine is already set up to fetch source using git and compile via gyp.

UPDATE: there's a pre-built executable available via https://github.com/atom/rcedit/releases/ and it works well for me on Win7 (from Git Bash/Msys shell although I'd be surprised if that makes a difference).

like image 84
natevw Avatar answered Oct 11 '22 20:10

natevw


Resource Hacker is a free tool that allows you to modify resources in executables, and it can be scripted from the command line.

like image 27
Simon Lieschke Avatar answered Oct 11 '22 21:10

Simon Lieschke