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

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

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

Use the Microsoft's DUMPBIN utility.

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

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

share|improve this answer
    
Why isn't it free if it can be obtained freely with the SDK? – CJ7 Mar 23 at 5:09
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

You can use sigcheck.exe portable tool which is part of Sysinternals Suite, e.g.

$ sigcheck.exe some_app.exe

Sigcheck v2.51 - File version and signature viewer
Copyright (C) 2004-2016 Mark Russinovich
Sysinternals - www.sysinternals.com

C:/Program Files (x86)/Foo App\some_app.exe:
    Verified:   Signed
    Signing date:   14:48 23/12/2015
    Publisher:  X
    Company:    X
    Description:    X
    Product:    Some App
    Prod version:   5.0.0.1241
    File version:   5.0.0.1241
    MachineType:    32-bit

For older version of Windows such as XP/2k/2003 (it still works in new), use filever.exe tool (check the direct link at exedll.info) to obtain specific information about a file such as:

  • The platform on which the file runs
  • The version of the file
  • The attributes of the file
  • The file type
  • The language of the file
  • Whether the file is a shipping type or a debug type
  • The file size
  • The date that the file was created
  • The path of the file

Some other to consider:

  • The Microsoft COFF Binary File Dumper (DUMPBIN.EXE)

    Displays information about Common Object File Format (COFF) binary files. You can use DUMPBIN to examine COFF object files, standard libraries of COFF objects, executable files, and dynamic-link libraries (DLLs).

  • binwalk - search the specified file(s) for executable opcodes common to a variety of CPU architectures. Easy to use tool for analyzing, reverse engineering, and extracting interesting files/data from binary files.


For more commands, check:

share|improve this answer

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.