How to set File Version and Product Version in EXE

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
twardega
Newbie
Posts: 15
Joined: Fri Oct 12, 2007 5:54 pm

How to set File Version and Product Version in EXE

Post by twardega » Thu Jun 19, 2014 6:11 pm

I would like to be able to set File version and Product version properties on the EXE file generated by Macro Scheduler Pro compiler. This will allow me to verify quickly if my clients are running the latest build of the macros that I have developed - by right-clicking on the exe file, selecting Properties and reading the values for these properties on the Details tab.

Right now both the File version and Product version properties are set to 1.0.0.0. Please advise if there is a way to set these property values before I run the compiler.

Tomek

User avatar
JRL
Automation Wizard
Posts: 3505
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: How to set File Version and Product Version in EXE

Post by JRL » Thu Jun 19, 2014 7:55 pm

I don't know of a way to accomplish this at compile time but you might try this post compile method. It takes a few seconds longer than it seems like it should but seems to work. It changed the version info and more importantly the new executable executed.

Could be made more user friendly but you know how to do that. :)

Code: Select all

Let>vPath=script_dir
Let>vNewPath=temp_dir
Let>vFile=MyExecutable.exe

Let>FileVer=F i l e V e r s i o n     1 . 0 . 0 . 0
Let>ProdVer=P r o d u c t V e r s i o n   1 . 0 . 0 . 0
Let>NewFileVer=F i l e V e r s i o n     2 . 3 . 4 . 5
Let>NewProdVer=P r o d u c t V e r s i o n   6 . 7 . 8 . 9

VBEval>chr(0),null
StringReplace>FileVer,space,null,FileVer
StringReplace>ProdVer,space,null,ProdVer
StringReplace>NewFileVer,space,null,NewFileVer
StringReplace>NewProdVer,space,null,NewProdVer

ReadFile>%vPath%\%vFile%,vData

Separate>vData,FileVer,Part
Let>vData=%Part_1%%NewFileVer%%Part_2%
Separate>vData,ProdVer,Part
Let>vData=%Part_1%%NewProdVer%%Part_2%


Let>WLN_NOCRLF=1
WriteLn>%vNewPath%\%vFile%,wres,vData

twardega
Newbie
Posts: 15
Joined: Fri Oct 12, 2007 5:54 pm

Re: How to set File Version and Product Version in EXE

Post by twardega » Fri Jun 27, 2014 2:13 pm

JRL - thank you very much for your suggestion.

I tested your solution and it works as long as the version number contains single digits in all positions. If you use more than one digit in any position of the version number, the EXE file will not work. You would get an error:
The application has failed to start because its side-by-side configuration is incorrect...

As a result I cannot use this solution as a general script that would reflect my build version. It would be great if Macro Scheduler Pro allowed to set the product version at the compile time, as opposed to a utility that sets it after EXE is created.

twardega
Newbie
Posts: 15
Joined: Fri Oct 12, 2007 5:54 pm

Re: How to set File Version and Product Version in EXE

Post by twardega » Fri Jun 27, 2014 2:22 pm

I should further explain that my scripts are compiled to EXE files and then included in an MSI file (using WIX). The MSI files are deployed to all users using Group Policy. It will be very helpful for me to be able to verify that the latest MSI contained the correct EXE build version and that it was correctly deployed when I have to troubleshoot problems - this can be accomplished if the product version is set at compile time.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: How to set File Version and Product Version in EXE

Post by Marcus Tettmar » Mon Jun 30, 2014 2:25 pm

You could use something like this:

http://www.the-software-box.com/changeversion.aspx
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

newuser
Pro Scripter
Posts: 64
Joined: Tue Jun 11, 2013 4:53 pm

Re: How to set File Version and Product Version in EXE

Post by newuser » Mon Feb 02, 2015 9:06 am

Marcus Tettmar wrote:You could use something like this:

http://www.the-software-box.com/changeversion.aspx
The link above no longer works.

BTW, any method to change file information such as description, copyright, product name etc?

Thank you.

I would prefer an easy method. Thank you.

User avatar
Phil Pendlebury
Automation Wizard
Posts: 538
Joined: Tue Jan 16, 2007 9:00 am
Contact:

Re: How to set File Version and Product Version in EXE

Post by Phil Pendlebury » Thu Feb 05, 2015 1:39 pm

I would also find this very useful. :-)
Phil Pendlebury - Linktree

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: How to set File Version and Product Version in EXE

Post by Marcus Tettmar » Fri Feb 06, 2015 10:38 am

It's on the wish list.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts