Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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
1  
What version of Windows? There have been some changes between '95 and 7. –  Daniel Beck Jan 13 '12 at 20:56
1  
Found this for you: stackoverflow.com/questions/602802/… –  billc.cn Jan 13 '12 at 21:08

1 Answer 1

up vote 4 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

Your Answer

 
discard

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.