Archive: FileVersion - requested feature


FileVersion - requested feature
It would be great to be able to grab the version of a file (major, minor, etc)
Any chance this sort of thing could be implemented into NSIS?


It already exists. The command is called GetDLLVersion.


The true reason I want to grab the file version is to specify the output filename. For example, if the file version is 1.2 I want the installer's filename to be something like "myapp12.exe" Currently I just edit a variable in my install script but because I'm lazy I'd like to automate this process.

I used GetDLLVersionLocal with success but it doesn't give me the version info I wanted. (at least I couldn't make sense of the numbers it returned)

Could someone please explain how to make sense of high dword and low dword outputs? I'd like to use the results in my install script. Thanks in advance.


About numbers returned GetDllVersion
About numbers GetDllVersion.
First 16 bit of first number is major version.
Second 16 bit of first number is minor version.
First 16 bit of second number is release version.
Second 16 bit of second number is build version.

So, try something like this:

GetDllVersion "MyApp.exe" $R0 $R1
IntOp $R2 $R0 / 0x00010000 ; $R2 now contains major version
IntOp $R3 $R0 & 0x0000FFFF ; $R3 now contains minor version
IntOp $R4 $R1 / 0x00010000 ; $R4 now contains release
IntOp $R5 $R1 & 0x0000FFFF ; $R5 now contains build
StrCpy $0 "$R2.$R3.$R4.$R5" ; $R0 now contains string like "1.2.0.192"


"StrCpy $0 "$R2.$R3.$R4.$R5" ; $R0 now contains string like "1.2.0.192""

Should be:
StrCpy $0 "$R2.$R3.$R4.$R5" ; $0 now contains string like "1.2.0.192"

Thanks for the help, v-tal. It is very much appreciated. :D