Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do grab the file version/product version from a file on the Windows 7 command line, to be used in a variable in a .bat file?

share|improve this question
Are you referring to actual DOS, or the Windows command line? In any case, please state the OS version you're working with. – Daniel Beck Jan 13 '12 at 20:51
Windows command line – csharpdev Jan 13 '12 at 20:55
What kind of file? How is the version information stored or accessed? – Keith Thompson Jan 13 '12 at 20:55
What version of Windows? There have been some changes between '95 and 7. – Daniel Beck Jan 13 '12 at 20:56
Found this for you:… – Jan 13 '12 at 21:08
up vote 6 down vote accepted

From my understanding you need filever.exe to do this. As pointed out in the comments. Also, I ripped the below word for word from here

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
share|improve this answer
This worked for me, except I used a vbscript to get the file version, but led me in right direction – csharpdev Jan 14 '12 at 18:25

You can check using sigcheck.exe which is part of Sysinternals Suite, e.g.

$ sigcheck.exe -q -n app.exe

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.