28

When I create a .exe, I can right click it and go to properties->details. Then I get a list like:

File Description | 
Type             | Application
File Version     | 
Product Name     | 
Product Version  |
Copyright        | 
Size             | 18.0 KB
Date Modified    | 6/16/2009 8:23 PM
Language         |

How do I change these properties? (And on a side note, is there a way to change the icon?)

alk
  • 69,737
  • 10
  • 105
  • 255
  • 2
    Is this an executable you are compiling, or an executable you do not have access to the source code of? – DeadHead Jun 20 '09 at 20:21
  • 1
    This is an executable I've already compiled from C++ code. –  Jun 20 '09 at 20:28
  • 1
    @Keand64: If you want to change it by hand, you can use File -> Open in Visual Studio to open the exe file and alter the resources easily. – Mehrdad Afshari Jun 20 '09 at 20:31

6 Answers6

30

If you are using C/Win32 you can add something like this to your project encapsulated in a *.rc (resource) file:

VS_VERSION_INFO VERSIONINFO
 FILEVERSION    0,0,0,2
 PRODUCTVERSION 0,0,0,2
 FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
 FILEFLAGS 0x1L
 #else
 FILEFLAGS 0x0L
 #endif
 FILEOS 0x4L
 FILETYPE 0x1L
 FILESUBTYPE 0x0L
{
    BLOCK "StringFileInfo"
    { 
        BLOCK "040904b0"
        {
            VALUE "Comments",         "comment\0"
            VALUE "CompanyName",      "comment\0"
            VALUE "FileDescription",  "base file\0"
            VALUE "FileVersion",      "0.0.0.2 TP\0"
            VALUE "InternalName",     "testTP\0"
            VALUE "LegalCopyright",   "none\0"
            VALUE "OriginalFilename", "test.exe\0"
            VALUE "ProductName",      "test\0"
            VALUE "ProductVersion",   "0.0.0.2 TP\0"
        } 
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x409, 1200
    }
}
merkuro
  • 6,161
  • 2
  • 27
  • 29
  • 4
    Could you elaborate a little? –  Jun 20 '09 at 20:43
  • 4
    @Keand64 You find additionally information on MSDN/VERSIONINFO http://msdn.microsoft.com/en-us/library/aa381058.aspx However I can try to shortly describe how it works for me in C (not sure if this is the preferred method in c++, but I didn't now about that you are doing this in C++). I add a resource file (eg. main.rc) to my project, add the code from above and edit it accordingly (see msdn). After a recompile my .exe file contains all the information. If I remember correctly in .NET you can do the same with the [assembly: AssemblyTitle("title")] command. – merkuro Jun 20 '09 at 21:10
  • Also, if you happen to be using MinGW (like I am), instead of using rc to compile your resource file which will be linked to your exe to provide this information, you should use windres: http://www.mingw.org/wiki/MS_resource_compiler . The MSDN link and that link should be enough to get your adding this extra info to your EXEs. – abelito Jul 07 '12 at 15:32
  • 1
    After creating a `.rc` file like this, you can use [GoRC](http://www.godevtool.com/) to compile it to a `.res` file using `gorc /fo Resources.res Resources.rc`. You can then use [Resource Hacker](http://www.angusj.com/resourcehacker/) to add it to an existing `.exe` using `ResHacker -add prog.exe, prog.exe, Resources.res,,,` (taken from my answer [here](http://stackoverflow.com/a/18839527/1563422)) – Danny Beckett Sep 17 '13 at 00:35
10

If you want to change the FileDescription or any other version resource string on a compiled executable, rcedit (a small open-source tool) does it pretty easily:

$ rcedit MyApp.exe --set-version-string FileDescription "My Awesome App"
a paid nerd
  • 30,702
  • 30
  • 134
  • 179
  • 2
    `rcedit` is pretty limited in terms of the properties it can set. – ashes999 Jul 28 '17 at 19:21
  • 1
    you can set everything with this tool see https://github.com/electron/rcedit/issues/2#issuecomment-111470339 – g.breeze Jan 09 '20 at 21:04
  • this worked for me however it removes **Digital Signatures** property of Executable – AbhishekS Oct 11 '21 at 13:08
  • 1
    @AbhishekS probably because any signatures would be invalid following a modification. You might need to run something like [SignTool.exe](https://learn.microsoft.com/en-us/dotnet/framework/tools/signtool-exe) – a paid nerd Oct 12 '21 at 16:21
8

Very easy if you are using visual studio:

  • Right click on the 'Resource Files' folder in the project
  • Click 'Add' then 'Resource'
  • Choose 'Version' from the pop-up dialog

You can then double click on the file to open it in Visual Studio, and you get a handy editor to change the values.

Your values are then automatically linked in to the EXE.

LarryDavid
  • 736
  • 6
  • 16
6

This is simple file version info resource. For already existent files you can edit this information with any resource editor (for example Resource Hacker, it is outdated but still good). You can change icon this way too.

If you create your own application, then setting it depends on tool you are using. For example in Visual Studio you must look into project properties.

arbiter
  • 9,447
  • 1
  • 32
  • 43
2
CharlesB
  • 86,532
  • 28
  • 194
  • 218
Nick Dandoulakis
  • 42,588
  • 16
  • 104
  • 136
-1

For .NET, google for "setting assembly attributes" for information on what attributes are available. You then use the attributes like so ...

using System.Reflection;  // Needed to get to the attributes.

[assembly:AssemblyTitle("My File Description")]
[etc.]
yoyo
  • 8,310
  • 4
  • 56
  • 50