Does Windows have an executable that I can run in the command shell which returns the version number of an executable (.exe) file?
I see a lot of questions that show how to do it from different languages, and references to third party software to write it, but I can't find a simple shell command to do it. Additional points if I don't need to install anything.
It must be run as normal user. Not administrator.
If you are willing and able to use PowerShell...
If you must run it in a cmd.exe shell, you could use:
This will give you only the file version:
Result:
and one way with
makecab
:example output (it has a string version which is a small addition to wmic method :) ):
also you can take a look at tooltipinfo.bat
You can use
wmic
to do it. And you can wrap it into a batch fileSave it as (example)
getVersion.cmd
and call asgetVersion.cmd "c:\windows\system32\msiexec.exe"
edited to adapt to comments and not require administrator rights. In this case, an hybrid cmd/javascript file is used to query wmi. Same usage