zabulus
zabulus

Reputation: 2523

Getting product version from file via cmd/bat

I have a file with Version resource that File vesrion/Product version fields are filled. I need to retrieve Product version via BAT file. Example, I have File with ProductVersion 1.0.1 in the output of bat file I wan't to have string "101" or "1.0.1"

Upvotes: 3

Views: 8398

Answers (4)

kenorb
kenorb

Reputation: 166843

You can use sigcheck tool which is part of Sysinternals Suite since filever is quiet old, e.g.

$ sigcheck.exe -q -n app.exe
5.0.0.1241

By specifying -q (quiet) and -n, it'll show you only the file version number.

Upvotes: 5

Nikolay Raspopov
Nikolay Raspopov

Reputation: 11

To read version from resource RC-file you can use:

for /F "tokens=3" %%a in ( 'findstr ProductVersion YourProgram.rc' ) do set VERSION=%%~a

Upvotes: 0

Usman Javaid
Usman Javaid

Reputation: 11

For dummy's like me there is one correction in the above statement to get the value of product version it would be like:

for /f "tokens=5 delims= " %%v in ('filever myFile.dll /b /v') do echo %%v

the /v parameter was missing and I am unable to get the correct value.

Upvotes: 1

Joey
Joey

Reputation: 354794

How to use the Filever.exe tool to obtain specific information about a file in Windows

From what I gather about filever's output it's always in columns and you want the fifth column (version). So a simple for should suffice:

for /f "tokens=5 delims= " %%v in ('filever myFile.dll /b') do echo %%v

Upvotes: 1

Related Questions