Any idea how to 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?

link|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 at 20:51
Windows command line – csharpdev Jan 13 at 20:55
What kind of file? How is the version information stored or accessed? – Keith Thompson Jan 13 at 20:55
1  
What version of Windows? There have been some changes between '95 and 7. – Daniel Beck Jan 13 at 20:56
1  
Found this for you: stackoverflow.com/questions/602802/… – billc.cn Jan 13 at 21:08
show 1 more comment
feedback

1 Answer

up vote 3 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
link|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 at 18:25
feedback

Your Answer

 
or
required, but never shown

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