120

As part of our build process I need to set the version information for all of our compiled binaries. Some of the binaries already have version information (added at compile time) and some do not.

I want to be able to apply the following information:

  • Company Name
  • Copyright Notice
  • Product Name
  • Product Description
  • File Version
  • Product Version

All of these attributes are specified by the build script and must be applied after compilation. These are standard binaries (not assemblies) compiled with C++ Builder 2007.

How can I do this?

Danny Beckett
  • 18,294
  • 21
  • 100
  • 129
Carl
  • 2,313
  • 4
  • 27
  • 30
  • for what use *ResourceHacker* ? how exactly task is set ? in what problem use `UpdateResource` function, if task update version in existing pe – RbMm Jan 26 '19 at 10:06
  • Try this: https://alternativeto.net/software/xn-resource-editor/ , I think there are reverse engineering tools do this – I_Al-thamary Jan 28 '19 at 16:31

15 Answers15

67

While it's not a batch process, Visual Studio can also add/edit file resources.

Just use File->Open->File on the .EXE or .DLL. This is handy for fixing version information post-build, or adding it to files that don't have these resources to begin with.

UweBaemayr
  • 1,461
  • 1
  • 15
  • 18
  • 9
    This worked perfectly when I tried it. For a file that is missing version info completely: After opening the DLL in Visual Studio, go to Edit > Add Resource > Version and click New. Then in the new Version tab, change FILEVERSION and PRODUCTVERSION, CompanyName, etc. Save the files and you're all set! – twasbrillig Nov 18 '14 at 22:09
  • 2
    @UweBaemayr. the answer you quoted I want to ask on same as can we automate it as exactly I do the same post build and I want to automate it . But how ? – SteveScm Dec 03 '14 at 09:07
  • 2
    For my old Delphi win32 dll this does not work. Altough the dll information is correctly changed, when running sanity checks on it you realize it's corrupted. – sthiers Aug 05 '16 at 08:34
  • 3
    Tried this (add version info) on Windows 8, VS 2015 and all is good in Windows Explorer, except ... the executable won't start anymore. – Liviu Apr 03 '17 at 10:38
  • Using Visual Studio works with Visual Studio 2015, but not with 2019. – Alenros Apr 05 '21 at 12:50
  • @Alenros It absolutely does work with VS 2019, at least for .exe files, which is what i worked with today. – Miqi180 Apr 19 '21 at 00:42
  • You are right, it does work in 2019. I think I accidentally used Open Folder (ctrl-O) instead of Open File (ctrl-shift-O). – Alenros Apr 19 '21 at 07:11
39

Unlike many of the other answers, this solution uses completely free software.

Firstly, create a file called Resources.rc like this:

VS_VERSION_INFO VERSIONINFO
    FILEVERSION    1,0,0,0
    PRODUCTVERSION 1,0,0,0
{
    BLOCK "StringFileInfo"
    {
        BLOCK "040904b0"
        {
            VALUE "CompanyName",        "ACME Inc.\0"
            VALUE "FileDescription",    "MyProg\0"
            VALUE "FileVersion",        "1.0.0.0\0"
            VALUE "LegalCopyright",     "© 2013 ACME Inc. All Rights Reserved\0"
            VALUE "OriginalFilename",   "MyProg.exe\0"
            VALUE "ProductName",        "My Program\0"
            VALUE "ProductVersion",     "1.0.0.0\0"
        }
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x409, 1200
    }
}

Next, use GoRC to compile it to a .res file using:

GoRC /fo Resources.res Resources.rc

(see my comment below for a mirror of GoRC.exe)

Then use Resource Hacker in CLI mode to add it to an existing .exe:

ResHacker -add MyProg.exe, MyProg.exe, Resources.res,,,

That's it!

Danny Beckett
  • 18,294
  • 21
  • 100
  • 129
  • 1
    @CharlesB I noticed that myself, but it's the right link. Looks like someone forgot to pay their web host! Here's the binary, I've mirrored it to my public Assembla account: https://www.assembla.com/code/danny-beckett/subversion/nodes/13/GoRC.exe – Danny Beckett Sep 17 '13 at 20:17
  • 4
    You can also use the Microsoft [Resource Compiler](http://msdn.microsoft.com/en-us/library/windows/desktop/aa381042(v=vs.85).aspx) in place of GoRC. It's available with the Windows SDK. – Holistic Developer Dec 19 '14 at 21:58
  • Thumbs up for Resource Hacker, I used it based in this answer it and it is brilliant, great program. (no affinity with program or maker ;-) – user2109254 Jun 25 '17 at 04:48
  • @UweKeim I haven't used this for a while, but I'm pretty sure they're required. – Danny Beckett Dec 02 '17 at 08:52
  • 6
    Seems like command line has changed a bit: `ResourceHacker.exe -open Source.dll -save Changed.dll -action addoverwrite -resource Version.res` Also, ResourceHacker can compile .rc file itself: `ResourceHacker.exe -open Version.rc -save Version.res -action compile` – Yusuf Tarık Günaydın Jun 26 '18 at 12:32
23

Or you could check out the freeware StampVer for Win32 exe/dll files.
It will only change the file and product versions though if they have a version resource already. It cannot add a version resource if one doesn’t exist.

Simon Sobisch
  • 4,650
  • 11
  • 33
Ryan
  • 631
  • 5
  • 7
19

rcedit is relative new and works well from the command line: https://github.com/atom/rcedit

$ rcedit "path-to-exe-or-dll" --set-version-string "Comments" "This is an exe"
$ rcedit "path-to-exe-or-dll" --set-file-version "10.7"
$ rcedit "path-to-exe-or-dll" --set-product-version "10.7"

There's also an NPM module which wraps it from JavaScript and a Grunt task in case you're using Grunt.

a paid nerd
  • 28,574
  • 30
  • 121
  • 167
  • 5
    note that rcedit can only modify existing resources not insert new ones – Bevan Collins Feb 07 '17 at 01:58
  • 3
    Doesn't work with 7zip sfx archives :/ Just cuts out the 7zip archive part. – Mgamerz Apr 14 '18 at 21:20
  • 1
    tried this, keeps giving unable to load file when in the same directory and seems like the tool may depend on host configuration – Arijoon Aug 30 '18 at 21:39
  • Works with the 7zS.sfx stub, the first part with the VERSIONINFO inside that you use to concat together a self extracting archive. Manually you can also rename 7zS.sfx in 7zS.exe and edit it in Visual Studio but since the version number is changing for every build you prefer a batch file with rcedit statements inside to set it. – AndresRohrAtlasInformatik Nov 19 '18 at 07:16
  • 1
    this tool is very nasty, please look at this bug before applying it onto your binaries: https://github.com/electron/rcedit/issues/51 – Brun Dec 10 '19 at 18:58
14

What about something like this?

verpatch /va foodll.dll %VERSION% %FILEDESCR% %COMPINFO% %PRODINFO% %BUILDINFO%

Available here with full sources.

CharlesB
  • 75,315
  • 26
  • 174
  • 199
filofel
  • 1,288
  • 7
  • 10
  • Verpatch seemed to create a bad product version resource for me (using the `/va /pv` option). The version appeared correctly in Windows Explorer but the last character was missing when retrieved in code with `VerQueryValue`. To fix the bad resource, I did this: (1) Load the DLL in Resource Hacker. (2) View the version resource. (3) Compile (modify something then change it back to enable the button). (4) Save. – dan-gph Apr 23 '13 at 02:11
  • verpatch works great for both x64 and x86 version of my DLLs on my dev box however in apveyor build project it only works for x64 and it is not doing absolutely nothing to the x86 dll -- no error either! any hints what might happen? I can see in appveyor log the verpatch command is executing, no errors, and the dll is not getting somehow replaced and the end it is not having the version stamp; for x64 everything works fine on all situations. any clues please? – Ovi Jun 24 '17 at 07:59
  • @Ovi-Wan Kenobi : I didn't know what apveyor was, but according to your description, it looks to me more like an apveyor problem. At worst, if that's possible, get ready for some debugging in the apveyor environment?... – filofel Jun 26 '17 at 07:32
11

There is this tool ChangeVersion [1]

List of features (from the website):

  • command line interface
  • support for .EXE, .DLL and .RES files
  • update FileVersion and ProductVersion based on a version mask
  • add/change/remove version key strings
  • adjust file flags (debug, special, private etc)
  • update project files ( .bdsproj | .bpr | .bpk | .dproj )
  • add/change main application icon
  • use ini file with configuration
  • Windows Vista support (needs elevation)
  • easy to integrate into a continuous build environment

Full Disclosure: I know the guy who wrote this tool, I used to work with him. But this also means that I know he makes quality software ;)


[1] the link is dead. There seems to be mirrored version at download.cnet.com.

Wolf
  • 8,482
  • 7
  • 48
  • 92
Otherside
  • 2,705
  • 20
  • 21
  • @Gareth I added a mirror link. Otherside, I doubt that this answer has any value without any working reference. – Wolf Sep 18 '15 at 08:17
  • 5
    The second link results in an expired tool `"Change Version v2012.9.6.0 - (C)2007-2012 The-Software-Box.com This trial version has expired"` – Preet Sangha Mar 04 '16 at 04:42
  • 2
    When running it in command line, it says "Change Version v2012.9.6.0 - (C)2007-2012 The-Software-Box.com This trial version has expired" – NoName Oct 15 '18 at 03:51
10

I'm doing it with no additional tool. I have just added the following files to my Win32 app project.

One header file which defines some constants than we can reuse on our resource file and even on the program code. We only need to maintain one file. Thanks to the Qt team that showed me how to do it on a Qt project, it now also works on my Win32 app.

----[version.h]----

#ifndef VERSION_H
#define VERSION_H

#define VER_FILEVERSION             0,3,0,0
#define VER_FILEVERSION_STR         "0.3.0.0\0"

#define VER_PRODUCTVERSION          0,3,0,0
#define VER_PRODUCTVERSION_STR      "0.3.0.0\0"

#define VER_COMPANYNAME_STR         "IPanera"
#define VER_FILEDESCRIPTION_STR     "Localiza archivos duplicados"
#define VER_INTERNALNAME_STR        "MyProject"
#define VER_LEGALCOPYRIGHT_STR      "Copyright 2016 ipanera@gmail.com"
#define VER_LEGALTRADEMARKS1_STR    "All Rights Reserved"
#define VER_LEGALTRADEMARKS2_STR    VER_LEGALTRADEMARKS1_STR
#define VER_ORIGINALFILENAME_STR    "MyProject.exe"
#define VER_PRODUCTNAME_STR         "My project"

#define VER_COMPANYDOMAIN_STR       "www.myurl.com"

#endif // VERSION_H

----[MyProjectVersion.rc]----

#include <windows.h>
#include "version.h"

VS_VERSION_INFO VERSIONINFO
FILEVERSION     VER_FILEVERSION
PRODUCTVERSION  VER_PRODUCTVERSION
BEGIN
    BLOCK "StringFileInfo"
    BEGIN
        BLOCK "040904E4"
        BEGIN
            VALUE "CompanyName",        VER_COMPANYNAME_STR
            VALUE "FileDescription",    VER_FILEDESCRIPTION_STR
            VALUE "FileVersion",        VER_FILEVERSION_STR
            VALUE "InternalName",       VER_INTERNALNAME_STR
            VALUE "LegalCopyright",     VER_LEGALCOPYRIGHT_STR
            VALUE "LegalTrademarks1",   VER_LEGALTRADEMARKS1_STR
            VALUE "LegalTrademarks2",   VER_LEGALTRADEMARKS2_STR
            VALUE "OriginalFilename",   VER_ORIGINALFILENAME_STR
            VALUE "ProductName",        VER_PRODUCTNAME_STR
            VALUE "ProductVersion",     VER_PRODUCTVERSION_STR
        END
    END

    BLOCK "VarFileInfo"
    BEGIN
        VALUE "Translation", 0x409, 1252
    END
END
Sensei James
  • 2,345
  • 25
  • 33
user3016543
  • 119
  • 1
  • 4
  • 2
    Just curious; how did you stop windows from overwriting your .rc file every time you change a dialog or modify any resource in the project? I've seen a couple of articles like this so far and it seems like it would work if you never have to change a resource again that would cause auto generation by the IDE. – shawn1874 Aug 03 '17 at 01:38
  • @shawn1874 -- Include the line `#include ` in the `resource.h` file that's added automatically. That file isn't regenerated (note at the top of the .rc file it indicates it's generated code, and can be modified in the designer). – CJBS Apr 11 '18 at 23:27
  • 1
    @CJBS that doesn't answer the question. Although that might work, it doesn't explain how the posted answer might work. In the posted answer user3016543 is including the version.h directly within the .rc file. There are several ways to deal with the overwrite of the .rc file which I know how to do. I'm only questioning the way that this particular answer is shown because it does not look right to me. – shawn1874 Jun 06 '18 at 23:25
  • I'm guessing that method works for him because the component in question doesn't have dialog components so the file doesn't get regenerated often or ever. However in a windows application with MFC dialog resources that would not be the case. – shawn1874 Jun 06 '18 at 23:32
  • 1
    Thanks for reminding me of a technique that I first saw in action in a resource file that shipped with the WinBatch Extender SDK. It had been so long since I've needed it that I had forgotten most of the details. Your explanation brought it all back. – David A. Gray Mar 05 '19 at 01:02
10

There are multiple tools, mentioned by many great answers, I'm going to pick one.

Resource Hacker

I downloaded latest version (5.1.7) from [AngusJ]: Resource Hacker. All the needed information can be found on that page (command line options, scripts, ...). In the following walkthrough I'm going to operate on 2 executables (lab rats) which (for obvious reasons) I've copied in my cwd:

  • ResourceHacker.exe: I thought it would be interesting to operate on itself
  • cmake.exe: random executable with no Version Info set (part of v3.6.3 installation on my machine)

Before going further, I want to mention that ResourceHacker has a funny terminal output, and the the following copy / paste fragments might generate a bit of confusion.

1. Setup

This is more like a preliminary step, to get acquainted with the environment, to show there's no funky business going on, ...

e:\Work\Dev\StackOverflow\q000284258> sopr.bat
*** Set shorter prompt to better fit when pasted in StackOverflow (or other) pages ***

[prompt]> dir
 Volume in drive E is Work
 Volume Serial Number is 3655-6FED

 Directory of e:\Work\Dev\StackOverflow\q000284258

2019-01-28  20:09    <DIR>          .
2019-01-28  20:09    <DIR>          ..
2016-11-03  09:17         5,413,376 cmake.exe
2019-01-03  02:06         5,479,424 ResourceHacker.exe
2019-01-28  20:30               496 ResourceHacker.ini
               3 File(s)     10,893,296 bytes
               2 Dir(s)  103,723,261,952 bytes free

[prompt]> set PATH=%PATH%;c:\Install\x64\CMake\CMake\3.6.3\bin

[prompt]> .\cmake --help >nul 2>&1

[prompt]> echo %errorlevel%
0

[prompt]> .\ResourceHacker.exe -help

[prompt]>

==================================
Resource Hacker Command Line Help:
==================================

-help             : displays these abbreviated help instructions.
-help commandline : displays help for single commandline instructions
-help script      : displays help for script file instructions.




[prompt]> echo %errorlevel%
0

As seen, the executables are OK, they run fine, and here's how their Details (that we care about) look like:

Img0-Initial

2. Resources

Resource files are text files that contain resources. A resource (simplified) has:

  • Name
  • Type
  • Value

For more details check [MS.Docs]: About Resource Files. There are many tools (mentioned in existing answers) that facilitate resource file editing like:

  • VStudio creates a default one when starting a new project
  • One can create such a file manually
  • But, since it's about Resource Hacker, and:

    • It is able to extract resources from an existing executable
    • It has resources embedded in it (as shown in the previous picture)

    I'm going to use it for this step (-action extract)

Next, In order for a resource to be embedded into an .exe (.dll, ...) it must be compiled to a binary form, which fits into the PE format. Again, there are lots of tools who can achieve this, but as you probably guessed I'm going to stick to Resource Hacker (-action compile).

[prompt]> :: Extract the resources into a file
[prompt]> .\ResourceHacker.exe -open .\ResourceHacker.exe -save .\sample.rc -action extract -mask VersionInfo,, -log con

[prompt]>

[28 Jan 2019, 20:58:03]

Current Directory:
e:\Work\Dev\StackOverflow\q000284258

Commandline:
.\ResourceHacker.exe  -open .\ResourceHacker.exe -save .\sample.rc -action extract -mask VersionInfo,, -log con

Open    : e:\Work\Dev\StackOverflow\q000284258\ResourceHacker.exe
Save    : e:\Work\Dev\StackOverflow\q000284258\sample.rc


Success!

[prompt]> :: Modify the resource file and set our own values
[prompt]>
[prompt]> :: Compile the resource file
[prompt]> .\ResourceHacker.exe -open .\sample.rc -save .\sample.res -action compile -log con

[prompt]>

[28 Jan 2019, 20:59:51]

Current Directory:
e:\Work\Dev\StackOverflow\q000284258

Commandline:
.\ResourceHacker.exe  -open .\sample.rc -save .\sample.res -action compile -log con

Open    : e:\Work\Dev\StackOverflow\q000284258\sample.rc
Save    : e:\Work\Dev\StackOverflow\q000284258\sample.res

Compiling: e:\Work\Dev\StackOverflow\q000284258\sample.rc
Success!

[prompt]> dir /b
cmake.exe
ResourceHacker.exe
ResourceHacker.ini
sample.rc
sample.res

In your case saving and editing the resource file won't be necessary, as the file will already be present, I just did it for demonstrating purposes. Below it's the resource file after being modified (and thus before being compiled).

sample.rc:

1 VERSIONINFO
FILEVERSION 3,1,4,1592
PRODUCTVERSION 2,7,1,8
FILEOS 0x4
FILETYPE 0x1
{
BLOCK "StringFileInfo"
{
    BLOCK "040904E4"
    {
        VALUE "CompanyName", "Cristi Fati\0"
        VALUE "FileDescription", "20190128 - SO q000284258 demo\0"
        VALUE "FileVersion", "3.1.4.1592\0"
        VALUE "ProductName", "Colonel Panic\0"
        VALUE "InternalName", "100\0"
        VALUE "LegalCopyright", "(c) Cristi Fati 1999-2999\0"
        VALUE "OriginalFilename", "ResHack\0"
        VALUE "ProductVersion", "2.7.1.8\0"
    }
}

BLOCK "VarFileInfo"
{
    VALUE "Translation", 0x0409 0x04E4  
}
}

3. Embed

This will also be performed by Resource Hacker (-action addoverwrite). Since the .exes are already copied I'm going to edit their resources in place.

[prompt]> .\ResourceHacker.exe -open .\cmake.exe -save .\cmake.exe -res .\sample.res -action addoverwrite -mask VersionInfo,, -log con

[prompt]>

[28 Jan 2019, 21:17:19]

Current Directory:
e:\Work\Dev\StackOverflow\q000284258

Commandline:
.\ResourceHacker.exe  -open .\cmake.exe -save .\cmake.exe -res .\sample.res -action addoverwrite -mask VersionInfo,, -log con

Open    : e:\Work\Dev\StackOverflow\q000284258\cmake.exe
Save    : e:\Work\Dev\StackOverflow\q000284258\cmake.exe
Resource: e:\Work\Dev\StackOverflow\q000284258\sample.res

  Added: VERSIONINFO,1,1033

Success!

[prompt]> copy ResourceHacker.exe ResourceHackerTemp.exe
        1 file(s) copied.

[prompt]> .\ResourceHackerTemp.exe -open .\ResourceHacker.exe -save .\ResourceHacker.exe -res .\sample.res -action addoverwrite -mask VersionInfo,, -log con

[prompt]>

[28 Jan 2019, 21:19:29]

Current Directory:
e:\Work\Dev\StackOverflow\q000284258

Commandline:
.\ResourceHackerTemp.exe  -open .\ResourceHacker.exe -save .\ResourceHacker.exe -res .\sample.res -action addoverwrite -mask VersionInfo,, -log con

Open    : e:\Work\Dev\StackOverflow\q000284258\ResourceHacker.exe
Save    : e:\Work\Dev\StackOverflow\q000284258\ResourceHacker.exe
Resource: e:\Work\Dev\StackOverflow\q000284258\sample.res

  Modified: VERSIONINFO,1,1033

Success!

[prompt]> del /f /q ResourceHackerTemp.*

[prompt]> dir
 Volume in drive E is Work
 Volume Serial Number is 3655-6FED

 Directory of e:\Work\Dev\StackOverflow\q000284258

2019-01-28  21:20    <DIR>          .
2019-01-28  21:20    <DIR>          ..
2016-11-03  09:17         5,414,400 cmake.exe
2019-01-03  02:06         5,479,424 ResourceHacker.exe
2019-01-28  21:17               551 ResourceHacker.ini
2019-01-28  20:05             1,156 sample.rc
2019-01-28  20:59               792 sample.res
               5 File(s)     10,896,323 bytes
               2 Dir(s)  103,723,253,760 bytes free

As seen, I had to d a little trick (gainarie) as I can't (at least I don't think I can) modify the .exe while in use.

4. Test

This is an optional phase, to make sure that:

  • The executables still work (they weren't messed up in the process)
  • The resources have been added / updated
[prompt]> .\cmake --help >nul 2>&1

[prompt]> echo %errorlevel%
0

[prompt]> .\ResourceHacker.exe -help

[prompt]>

==================================
Resource Hacker Command Line Help:
==================================

-help             : displays these abbreviated help instructions.
-help commandline : displays help for single commandline instructions
-help script      : displays help for script file instructions.




[prompt]> echo %errorlevel%
0

And their Details:

Img1-Final

CristiFati
  • 28,721
  • 9
  • 41
  • 63
  • @ColonelPanic: Thank you! – CristiFati Jan 31 '19 at 16:49
  • Very nice answer. Unfortunately ResourceHacker is no longer maintained and runs out of memory when trying to edit a large EXE file (I got the error trying to open a 3GB exe). – Lews Therin Jul 23 '19 at 20:04
  • @LewsTherin: The latest version (also used by the answer) is from 2019/01, so I'd say it's pretty maintained. The problem is that it's *32bit*. You could contact the authors asking for a *64bit* version (I assume that since they already have the code it wouldn't be hard to build it for *64bit*). – CristiFati Jul 23 '19 at 20:55
9

verpatch is good, but doesn't handle unicode characters...
try ResourceLib

techvice
  • 1,238
  • 1
  • 14
  • 24
user581430
  • 99
  • 1
  • 1
5

the above answer from @DannyBeckett helped me a lot,

I put the following in a batch file & I place it in the same folder where ResourceHacker.exe & the EXE I work on is located & it works excellent. [you may edit it to fit your needs]

    @echo off
    :start1
    set /p newVersion=Enter version number [?.?.?.?]:
    if "%newVersion%" == "" goto start1
    :start2
    set /p file=Enter EXE name [for 'program.exe' enter 'program']:
    if "%file%" == "" goto start2
    for /f "tokens=1-4 delims=." %%a in ('echo %newVersion%') do (set ResVersion=%%a,%%b,%%c,%%d)
    (
    echo:VS_VERSION_INFO VERSIONINFO
    echo:    FILEVERSION    %ResVersion%
    echo:    PRODUCTVERSION %ResVersion%
    echo:{
    echo:    BLOCK "StringFileInfo"
    echo:    {
    echo:        BLOCK "040904b0"
    echo:        {
    echo:            VALUE "CompanyName",        "MyCompany\0"
    echo:            VALUE "FileDescription",    "TestFile\0"
    echo:            VALUE "FileVersion",        "%newVersion%\0"
    echo:            VALUE "LegalCopyright",     "COPYRIGHT © 2019 MyCompany\0"
    echo:            VALUE "OriginalFilename",   "%file%.exe\0"
    echo:            VALUE "ProductName",        "Test\0"
    echo:            VALUE "ProductVersion",     "%newVersion%\0"
    echo:        }
    echo:    }
    echo:    BLOCK "VarFileInfo"
    echo:    {
    echo:        VALUE "Translation", 0x409, 1200
    echo:    }
    echo:}
    ) >Resources.rc     &&      echo setting Resources.rc
    ResourceHacker.exe -open resources.rc -save resources.res -action compile -log CONSOLE
    ResourceHacker -open "%file%.exe" -save "%file%Res.exe" -action addoverwrite -resource "resources.res"  -log CONSOLE
    ResourceHacker.exe -open "%file%Res.exe" -save "%file%Ico.exe" -action addskip -res "%file%.ico" -mask ICONGROUP,MAINICON, -log CONSOLE
    xCopy /y /f "%file%Ico.exe" "%file%.exe"
    echo.
    echo.
    echo your compiled file %file%.exe is ready
    pause

[as a side note i used resource hacker also to compile the res file, not GoRC]

RDR
  • 81
  • 1
  • 6
4

A little late to the party, but since I was looking for it (and I might need to find it again sometime), here's what I did to include version, company name, etc. into my C++ DLL under VS2013 Express:

  1. Created and edited a dllproj.rc file, as indicated previously.
  2. Added the line "rc.exe dllproj.rc" as a pre-build step in the DLL project.
  3. Added dllproj.res to the resource folder for the project.

Hope this helps!

Tom Gordon
  • 101
  • 1
  • 2
3

There is Resource Tuner Console from Heaventools Software.

Resource Tuner Console is a command-line tool that enables developers to automate editing of different resource types in large numbers of Windows 32- and 64-bit executable files.

See specifically the Changing Version Variables And Updating The Version Information page for greater details.

CharlesB
  • 75,315
  • 26
  • 174
  • 199
Wylder
  • 291
  • 2
  • 3
3

You can actually try downloading FVIE from Download Link and try editing the information for any .exe file.

(OR)

You can download StampVer – Win32 Version Resource Stamping from Download Link which is really usefull for windows .exe files.

(OR)

You could use a command tool called RCEDIT. Download from Github Source link and then build using Visual Studio 2015 and then you have specific commands to change the version of .exe files. See Docs link for various available commands.

Subash J
  • 1,901
  • 2
  • 11
  • 24
1

This is the best tool I've seen for the job, allows full control over all file resources, VersionInfo included.

See: ResourceEditor by Anders Melander.

Community
  • 1
  • 1
J Collins
  • 1,966
  • 22
  • 27
0

I want to put together a more compact version

  • Step 1: create resource
  • Step 2: Download ResourceHacker
  • Step 3: Compile res into rc files
  • Step 4: Run script: modify exe

Step 1: create resource

Prepare the resource file: resource.rc

VS_VERSION_INFO VERSIONINFO
    FILEVERSION    0,0,0,0
    PRODUCTVERSION 0,0,0,0
{
    BLOCK "StringFileInfo"
    {
        BLOCK "040904b0"
        {
            VALUE "CompanyName",        "\0"
            VALUE "FileDescription",    "\0"
            VALUE "FileVersion",        "0.0.0.0\0"
            VALUE "LegalCopyright",     "© 2020 Carson. All rights reserved.\0"
            VALUE "OriginalFilename",   ".exe\0"
            VALUE "ProductName",        "\0"
            VALUE "ProductVersion",     "0.0.0.0\0"
        }
    }
    BLOCK "VarFileInfo"
    {
        VALUE "Translation", 0x0409, 1200
    }
}

Step 2: Download ResourceHacker

There have two methods that can get it.

  1. Download from Chocolatey:
    • install choco
    • choco install reshack -y
    • After installation, you may need to add environment variables.
  2. ResourceHacker Website

Step 3: Compile res into rc files

ResourceHacker.exe -open resources.rc -save resources.res ^
 -action compile -log CONSOLE

Step 4: Run script: modify exe

SET INPUT_EXE=app.exe
SET OUTPUT_EXE=app.exe
ResourceHacker.exe -open %OUTPUT_EXE% -save %OUTPUT_EXE% ^
 -resource resources.res ^
 -action addoverwrite ^
 -mask VersionInf ^
 -log CONSOLE

Summary Script

SET INPUT_EXE=app.exe
SET OUTPUT_EXE=app.exe

ResourceHacker.exe -open resources.rc -save resources.res ^
 -action compile -log CONSOLE

ResourceHacker.exe -open %OUTPUT_EXE% -save %OUTPUT_EXE% ^
 -resource resources.res ^
 -action addoverwrite ^
 -mask VersionInf ^
 -log CONSOLE

Reference

Carson
  • 1,762
  • 1
  • 10
  • 23