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.

With most Windows executables (DLL, EXE...), version and other details can be viewed using "Details" tab in "Properties" (Alt+Enter).

Details of shell32.dll from Windows 7 amd64

I wonder: is there also a command-line way to do this? I'm particularly interested for Product version, but also other things could be useful.

Following properties are desired, in order of precedence:

  • accept exe/dll path as a parameter
  • output to standard output (so you can process the rest via | pipe)
  • available by default in all supported Windows (XP+)
  • available by default in Windows Vista+
  • available by default in Windows XP
  • usable in commercial environment
  • free license (GPL-like)
  • portable (ie. standalone exe, maybe accompanied with DLL)
share|improve this question
    
This has been already asked on Stack Overflow: Command line tool to dump Windows DLL version? –  Alois Mahdal Jan 24 '12 at 14:33

3 Answers 3

Use the Microsoft's DUMPBIN utility - http://msdn.microsoft.com/en-us/library/c1h23y6c(v=vs.100).aspx

It has lots of useful options, however, it depends on what do you want to do.

EDIT: However, it's not free but I believe can be obtained freely with Windows SDK.

share|improve this answer
Function GetProductVersion (sFilePath, sProgram)  
Dim objShell, objFolder, objFolderItem, i  
If FSO.FileExists(sFilePath & "\" & sProgram) Then  
    Set objShell = CreateObject("Shell.Application")  
    Set objFolder = objShell.Namespace(sFilePath)  
    Set objFolderItem = objFolder.ParseName(sProgram)  
    Dim arrHeaders(300)  
    For i = 0 To 300  
        arrHeaders(i) = objFolder.GetDetailsOf(objFolder.Items, i)  
        'WScript.Echo i &"- " & arrHeaders(i) & ": " & objFolder.GetDetailsOf(objFolderItem, i)  
        If lcase(arrHeaders(i))= "product version" Then  
            GetProductVersion= objFolder.GetDetailsOf(objFolderItem, i)  
            Exit For  
        End If  
    Next  
End If  
End Function  

Source is a link to a .vbs file that can get the file version for you, and you can take that and use the output however you want.

Ships will all versions of windows, not sure about the license, very portable, but not exe or DLL.

share|improve this answer
    
There's a couple of answers there, I'm not sure which one you mean. However, I tried some of them, they seem to have path to notepad.exe hard-coded. Is there an easy way to wrap them up so that they accept path to dll/exe as a parameter? Preferably outputting to standard output? –  Alois Mahdal Jan 23 '12 at 2:24
    
It takes a path as a parameter, and the product version is contained in GetProductVersion –  soandos Jan 23 '12 at 2:35

In powershell, get-command "full-path-to-executable" | format-list would do the trick. Powershell is the new command-line for Vista and later Windows, can be installed in XP.

share|improve this answer
    
I can't get your code to work... –  soandos Jan 23 '12 at 2:29
    
I've got as far as get-command "$args[0]" | format-list, which i've saved as aaa.ps1 and called as powershell -File aaa.ps1 shell32.dll but that does not print anything. –  Alois Mahdal Jan 23 '12 at 2:31
    
@soandos: it appears powershell v2 is required for get-command to work with arbitrary executables. –  kreemoweet Jan 24 '12 at 3:01
    
I have powershell v2 –  soandos Jan 24 '12 at 3:21
    
nice, I didn't knew that, it even return a little more information than the property window. The interesting info is encapsulated in the FileInfoVersion property of the ApplicationInfo object. –  mjsr Feb 7 '12 at 15:27

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.